diff options
author | José Fonseca <[email protected]> | 2015-01-20 23:34:26 +0000 |
---|---|---|
committer | Jose Fonseca <[email protected]> | 2015-01-30 15:24:33 +0000 |
commit | d7f2dfb67ee9c50f221d35c840d3427e8f184209 (patch) | |
tree | 3569cc48a55d9844400832a79073682e1e30be1a /src/util/u_atomic.h | |
parent | a7eec6d620a333b722157cf1a2865b050d210aad (diff) |
util/u_atomic: Use _Interlocked* intrinsics for non 64bits.
The intrinsics are universally available, whereas older Windows SDKs (e.g.
7.0.7600) don't have the non-intrisic entrypoint.
Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/util/u_atomic.h')
-rw-r--r-- | src/util/u_atomic.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/util/u_atomic.h b/src/util/u_atomic.h index 40100363875..a528e01bc98 100644 --- a/src/util/u_atomic.h +++ b/src/util/u_atomic.h @@ -71,8 +71,8 @@ #define PIPE_ATOMIC "MSVC Intrinsics" -/* We use the Windows header's Interlocked* functions instead of the - * _Interlocked* intrinsics wherever we can, as support for the latter varies +/* We use the Windows header's Interlocked*64 functions instead of the + * _Interlocked*64 intrinsics wherever we can, as support for the latter varies * with target CPU, whereas Windows headers take care of all portability * issues: using intrinsics where available, falling back to library * implementations where not. @@ -102,25 +102,25 @@ ((void) p_atomic_inc_return(_v)) #define p_atomic_inc_return(_v) (\ - sizeof *(_v) == sizeof(short) ? InterlockedIncrement16((short *) (_v)) : \ - sizeof *(_v) == sizeof(long) ? InterlockedIncrement ((long *) (_v)) : \ - sizeof *(_v) == sizeof(__int64) ? InterlockedIncrement64((__int64 *)(_v)) : \ + sizeof *(_v) == sizeof(short) ? _InterlockedIncrement16((short *) (_v)) : \ + sizeof *(_v) == sizeof(long) ? _InterlockedIncrement ((long *) (_v)) : \ + sizeof *(_v) == sizeof(__int64) ? InterlockedIncrement64 ((__int64 *)(_v)) : \ (assert(!"should not get here"), 0)) #define p_atomic_dec(_v) \ ((void) p_atomic_dec_return(_v)) #define p_atomic_dec_return(_v) (\ - sizeof *(_v) == sizeof(short) ? InterlockedDecrement16((short *) (_v)) : \ - sizeof *(_v) == sizeof(long) ? InterlockedDecrement ((long *) (_v)) : \ - sizeof *(_v) == sizeof(__int64) ? InterlockedDecrement64((__int64 *)(_v)) : \ + sizeof *(_v) == sizeof(short) ? _InterlockedDecrement16((short *) (_v)) : \ + sizeof *(_v) == sizeof(long) ? _InterlockedDecrement ((long *) (_v)) : \ + sizeof *(_v) == sizeof(__int64) ? InterlockedDecrement64 ((__int64 *)(_v)) : \ (assert(!"should not get here"), 0)) #define p_atomic_cmpxchg(_v, _old, _new) (\ - sizeof *(_v) == sizeof(char) ? _InterlockedCompareExchange8((char *) (_v), (char) (_new), (char) (_old)) : \ - sizeof *(_v) == sizeof(short) ? InterlockedCompareExchange16((short *) (_v), (short) (_new), (short) (_old)) : \ - sizeof *(_v) == sizeof(long) ? InterlockedCompareExchange ((long *) (_v), (long) (_new), (long) (_old)) : \ - sizeof *(_v) == sizeof(__int64) ? InterlockedCompareExchange64((__int64 *)(_v), (__int64)(_new), (__int64)(_old)) : \ + sizeof *(_v) == sizeof(char) ? _InterlockedCompareExchange8 ((char *) (_v), (char) (_new), (char) (_old)) : \ + sizeof *(_v) == sizeof(short) ? _InterlockedCompareExchange16((short *) (_v), (short) (_new), (short) (_old)) : \ + sizeof *(_v) == sizeof(long) ? _InterlockedCompareExchange ((long *) (_v), (long) (_new), (long) (_old)) : \ + sizeof *(_v) == sizeof(__int64) ? InterlockedCompareExchange64 ((__int64 *)(_v), (__int64)(_new), (__int64)(_old)) : \ (assert(!"should not get here"), 0)) #endif |