aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util/u_atomic.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-11-29 12:40:08 +0100
committermarha <marha@users.sourceforge.net>2014-11-29 12:40:08 +0100
commita1011d63ffb5cc4f41bf0f4622ee3f1493d419d9 (patch)
tree3875aa5d80808dfe3c52035a4148384d7090fb8a /mesalib/src/gallium/auxiliary/util/u_atomic.h
parentd6d5581d5fba846c8476ad4d593da662306765d7 (diff)
downloadvcxsrv-a1011d63ffb5cc4f41bf0f4622ee3f1493d419d9.tar.gz
vcxsrv-a1011d63ffb5cc4f41bf0f4622ee3f1493d419d9.tar.bz2
vcxsrv-a1011d63ffb5cc4f41bf0f4622ee3f1493d419d9.zip
fontconfig libX11 libxcb libxcb/xcb-proto mesa xserver xkbcomp xkeyboard-config git update 29 Nov 2014
xserver commit c52a2b1ebad56820af932dfbc871701a8b04fd9c libxcb commit bbca7b82f803fa13fd30a2891ec06f2a213a28c2 libxcb/xcb-proto commit 691d2b97e5989d6d7006304d81bd8fa128477ca1 xkeyboard-config commit b664d7fb8aab9b0f834dd9c81d273c7809561b34 libX11 commit f3831dde6972e4da9e018c6a5f4013d8756a5e78 xkbcomp commit 1e8ee9d0aad072f04186df84752f5636340574e0 fontconfig commit b732bf057f4b3ec3bac539803005e9c42d056b2a mesa commit 67c498086d0858a94d53ebb6921cfda847250368
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util/u_atomic.h')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_atomic.h56
1 files changed, 54 insertions, 2 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_atomic.h b/mesalib/src/gallium/auxiliary/util/u_atomic.h
index 2f2b42b34..2500bc752 100644
--- a/mesalib/src/gallium/auxiliary/util/u_atomic.h
+++ b/mesalib/src/gallium/auxiliary/util/u_atomic.h
@@ -24,12 +24,12 @@
#define PIPE_ATOMIC_MSVC_INTRINSIC
#elif (defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86))
#define PIPE_ATOMIC_ASM_MSVC_X86
+#elif defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 401)
+#define PIPE_ATOMIC_GCC_INTRINSIC
#elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86))
#define PIPE_ATOMIC_ASM_GCC_X86
#elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64))
#define PIPE_ATOMIC_ASM_GCC_X86_64
-#elif defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 401)
-#define PIPE_ATOMIC_GCC_INTRINSIC
#else
#error "Unsupported platform"
#endif
@@ -69,6 +69,18 @@ p_atomic_dec(int32_t *v)
}
static INLINE int32_t
+p_atomic_inc_return(int32_t *v)
+{
+ return __sync_add_and_fetch(v, 1);
+}
+
+static INLINE int32_t
+p_atomic_dec_return(int32_t *v)
+{
+ return __sync_sub_and_fetch(v, 1);
+}
+
+static INLINE int32_t
p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new)
{
return __sync_val_compare_and_swap(v, old, _new);
@@ -116,6 +128,18 @@ p_atomic_dec(int32_t *v)
}
static INLINE int32_t
+p_atomic_inc_return(int32_t *v)
+{
+ return __sync_add_and_fetch(v, 1);
+}
+
+static INLINE int32_t
+p_atomic_dec_return(int32_t *v)
+{
+ return __sync_sub_and_fetch(v, 1);
+}
+
+static INLINE int32_t
p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new)
{
return __sync_val_compare_and_swap(v, old, _new);
@@ -161,6 +185,18 @@ p_atomic_dec(int32_t *v)
}
static INLINE int32_t
+p_atomic_inc_return(int32_t *v)
+{
+ return __sync_add_and_fetch(v, 1);
+}
+
+static INLINE int32_t
+p_atomic_dec_return(int32_t *v)
+{
+ return __sync_sub_and_fetch(v, 1);
+}
+
+static INLINE int32_t
p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new)
{
return __sync_val_compare_and_swap(v, old, _new);
@@ -186,6 +222,8 @@ p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new)
#define p_atomic_dec_zero(_v) ((boolean) --(*(_v)))
#define p_atomic_inc(_v) ((void) (*(_v))++)
#define p_atomic_dec(_v) ((void) (*(_v))--)
+#define p_atomic_inc_return(_v) ((*(_v))++)
+#define p_atomic_dec_return(_v) ((*(_v))--)
#define p_atomic_cmpxchg(_v, old, _new) (*(_v) == old ? *(_v) = (_new) : *(_v))
#endif
@@ -288,6 +326,12 @@ p_atomic_inc(int32_t *v)
_InterlockedIncrement((long *)v);
}
+static INLINE int32_t
+p_atomic_inc_return(int32_t *v)
+{
+ return _InterlockedIncrement((long *)v);
+}
+
static INLINE void
p_atomic_dec(int32_t *v)
{
@@ -295,6 +339,12 @@ p_atomic_dec(int32_t *v)
}
static INLINE int32_t
+p_atomic_dec_return(int32_t *v)
+{
+ return _InterlockedDecrement((long *)v);
+}
+
+static INLINE int32_t
p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new)
{
return _InterlockedCompareExchange((long *)v, _new, old);
@@ -329,6 +379,8 @@ p_atomic_dec_zero(int32_t *v)
#define p_atomic_inc(_v) atomic_inc_32((uint32_t *) _v)
#define p_atomic_dec(_v) atomic_dec_32((uint32_t *) _v)
+#define p_atomic_inc_return(_v) atomic_inc_32_nv((uint32_t *) _v)
+#define p_atomic_dec_return(_v) atomic_dec_32_nv((uint32_t *) _v)
#define p_atomic_cmpxchg(_v, _old, _new) \
atomic_cas_32( (uint32_t *) _v, (uint32_t) _old, (uint32_t) _new)