aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-05-06 18:29:53 -0700
committerChris Robinson <[email protected]>2014-05-06 18:29:53 -0700
commit0ea979a262d4409a830354cbbc6eb3bea6f455a3 (patch)
treec230c59be9f8556a47798c2641256bf3f4c9f294 /Alc
parent1a76a3238c86cc40499e0c724f698d9b17f776c4 (diff)
Move some headers to include/
Note, these are not installed. Only headers in include/AL/ are installed.
Diffstat (limited to 'Alc')
-rw-r--r--Alc/align.h21
-rw-r--r--Alc/atomic.h141
2 files changed, 0 insertions, 162 deletions
diff --git a/Alc/align.h b/Alc/align.h
deleted file mode 100644
index babd4106..00000000
--- a/Alc/align.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef AL_ALIGN_H
-#define AL_ALIGN_H
-
-#ifdef HAVE_STDALIGN_H
-#include <stdalign.h>
-#endif
-
-#ifndef alignas
-#ifdef HAVE_C11_ALIGNAS
-#define alignas _Alignas
-#elif defined(IN_IDE_PARSER)
-/* KDevelop has problems with our align macro, so just use nothing for parsing. */
-#define alignas(x)
-#else
-/* NOTE: Our custom ALIGN macro can't take a type name like alignas can. For
- * maximum compatibility, only provide constant integer values to alignas. */
-#define alignas(_x) ALIGN(_x)
-#endif
-#endif
-
-#endif /* AL_ALIGN_H */
diff --git a/Alc/atomic.h b/Alc/atomic.h
deleted file mode 100644
index 10f8e436..00000000
--- a/Alc/atomic.h
+++ /dev/null
@@ -1,141 +0,0 @@
-#ifndef AL_ATOMIC_H
-#define AL_ATOMIC_H
-
-
-typedef void *volatile XchgPtr;
-
-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && !defined(__QNXNTO__)
-typedef unsigned int RefCount;
-inline RefCount IncrementRef(volatile RefCount *ptr)
-{ return __sync_add_and_fetch(ptr, 1); }
-inline RefCount DecrementRef(volatile RefCount *ptr)
-{ return __sync_sub_and_fetch(ptr, 1); }
-
-inline int ExchangeInt(volatile int *ptr, int newval)
-{
- return __sync_lock_test_and_set(ptr, newval);
-}
-inline void *ExchangePtr(XchgPtr *ptr, void *newval)
-{
- return __sync_lock_test_and_set(ptr, newval);
-}
-inline int CompExchangeInt(volatile int *ptr, int oldval, int newval)
-{
- return __sync_val_compare_and_swap(ptr, oldval, newval);
-}
-inline void *CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval)
-{
- return __sync_val_compare_and_swap(ptr, oldval, newval);
-}
-
-#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
-
-inline unsigned int xaddl(volatile unsigned int *dest, int incr)
-{
- unsigned int ret;
- __asm__ __volatile__("lock; xaddl %0,(%1)"
- : "=r" (ret)
- : "r" (dest), "0" (incr)
- : "memory");
- return ret;
-}
-
-typedef unsigned int RefCount;
-inline RefCount IncrementRef(volatile RefCount *ptr)
-{ return xaddl(ptr, 1)+1; }
-inline RefCount DecrementRef(volatile RefCount *ptr)
-{ return xaddl(ptr, -1)-1; }
-
-inline int ExchangeInt(volatile int *dest, int newval)
-{
- int ret;
- __asm__ __volatile__("lock; xchgl %0,(%1)"
- : "=r" (ret)
- : "r" (dest), "0" (newval)
- : "memory");
- return ret;
-}
-inline void *ExchangePtr(XchgPtr *dest, void *newval)
-{
- void *ret;
- __asm__ __volatile__(
-#ifdef __i386__
- "lock; xchgl %0,(%1)"
-#else
- "lock; xchgq %0,(%1)"
-#endif
- : "=r" (ret)
- : "r" (dest), "0" (newval)
- : "memory"
- );
- return ret;
-}
-inline int CompExchangeInt(volatile int *dest, int oldval, int newval)
-{
- int ret;
- __asm__ __volatile__("lock; cmpxchgl %2,(%1)"
- : "=a" (ret)
- : "r" (dest), "r" (newval), "0" (oldval)
- : "memory");
- return ret;
-}
-inline void *CompExchangePtr(XchgPtr *dest, void *oldval, void *newval)
-{
- void *ret;
- __asm__ __volatile__(
-#ifdef __i386__
- "lock; cmpxchgl %2,(%1)"
-#else
- "lock; cmpxchgq %2,(%1)"
-#endif
- : "=a" (ret)
- : "r" (dest), "r" (newval), "0" (oldval)
- : "memory"
- );
- return ret;
-}
-
-#elif defined(_WIN32)
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-typedef LONG RefCount;
-inline RefCount IncrementRef(volatile RefCount *ptr)
-{ return InterlockedIncrement(ptr); }
-inline RefCount DecrementRef(volatile RefCount *ptr)
-{ return InterlockedDecrement(ptr); }
-
-static_assert(sizeof(LONG)==sizeof(int), "sizeof LONG does not match sizeof int");
-
-inline int ExchangeInt(volatile int *ptr, int newval)
-{
- union {
- volatile int *i;
- volatile LONG *l;
- } u = { ptr };
- return InterlockedExchange(u.l, newval);
-}
-inline void *ExchangePtr(XchgPtr *ptr, void *newval)
-{
- return InterlockedExchangePointer(ptr, newval);
-}
-inline int CompExchangeInt(volatile int *ptr, int oldval, int newval)
-{
- union {
- volatile int *i;
- volatile LONG *l;
- } u = { ptr };
- return InterlockedCompareExchange(u.l, newval, oldval);
-}
-inline void *CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval)
-{
- return InterlockedCompareExchangePointer(ptr, newval, oldval);
-}
-
-#else
-#error "No atomic functions available on this platform!"
-typedef ALuint RefCount;
-#endif
-
-#endif /* AL_ATOMIC_H */