summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <[email protected]>2016-02-24 12:50:27 -0800
committerKristian Høgsberg Kristensen <[email protected]>2016-02-24 13:04:54 -0800
commit59f57289959702e528b68bdd0d06488089517a00 (patch)
treea266656ac6129f5ad14b9d0d0c69c7077466c3f3 /src/util
parent25c2470b24ce8411f6747eb887137b2511b6d529 (diff)
parentc95d5c5f6fbfe4a96276e67ed279562b33432fb5 (diff)
Merge remote-tracking branch 'origin/master' into vulkan
Diffstat (limited to 'src/util')
-rw-r--r--src/util/hash_table.h4
-rw-r--r--src/util/u_atomic.h59
2 files changed, 3 insertions, 60 deletions
diff --git a/src/util/hash_table.h b/src/util/hash_table.h
index 85b013cac24..c69abfa3e64 100644
--- a/src/util/hash_table.h
+++ b/src/util/hash_table.h
@@ -108,7 +108,9 @@ static inline uint32_t _mesa_hash_pointer(const void *pointer)
return _mesa_hash_data(&pointer, sizeof(pointer));
}
-static const uint32_t _mesa_fnv32_1a_offset_bias = 2166136261u;
+enum {
+ _mesa_fnv32_1a_offset_bias = 2166136261u,
+};
static inline uint32_t
_mesa_fnv32_1a_accumulate_block(uint32_t hash, const void *data, size_t size)
diff --git a/src/util/u_atomic.h b/src/util/u_atomic.h
index e38395ac633..867590391f4 100644
--- a/src/util/u_atomic.h
+++ b/src/util/u_atomic.h
@@ -88,65 +88,6 @@
#include <intrin.h>
#include <assert.h>
-#if _MSC_VER < 1600
-
-/* Implement _InterlockedCompareExchange8 in terms of _InterlockedCompareExchange16 */
-static __inline char
-_InterlockedCompareExchange8(char volatile *destination8, char exchange8, char comparand8)
-{
- INT_PTR destinationAddr = (INT_PTR)destination8;
- short volatile *destination16 = (short volatile *)(destinationAddr & ~1);
- const short shift8 = (destinationAddr & 1) * 8;
- const short mask8 = 0xff << shift8;
- short initial16 = *destination16;
- char initial8 = initial16 >> shift8;
- while (initial8 == comparand8) {
- /* initial *destination8 matches, so try exchange it while keeping the
- * neighboring byte untouched */
- short exchange16 = (initial16 & ~mask8) | ((short)exchange8 << shift8);
- short comparand16 = initial16;
- short initial16 = _InterlockedCompareExchange16(destination16, exchange16, comparand16);
- if (initial16 == comparand16) {
- /* succeeded */
- return comparand8;
- }
- /* something changed, retry with the new initial value */
- initial8 = initial16 >> shift8;
- }
- return initial8;
-}
-
-/* Implement _InterlockedExchangeAdd16 in terms of _InterlockedCompareExchange16 */
-static __inline short
-_InterlockedExchangeAdd16(short volatile *addend, short value)
-{
- short initial = *addend;
- short comparand;
- do {
- short exchange = initial + value;
- comparand = initial;
- /* if *addend==comparand then *addend=exchange, return original *addend */
- initial = _InterlockedCompareExchange16(addend, exchange, comparand);
- } while(initial != comparand);
- return comparand;
-}
-
-/* Implement _InterlockedExchangeAdd8 in terms of _InterlockedCompareExchange8 */
-static __inline char
-_InterlockedExchangeAdd8(char volatile *addend, char value)
-{
- char initial = *addend;
- char comparand;
- do {
- char exchange = initial + value;
- comparand = initial;
- initial = _InterlockedCompareExchange8(addend, exchange, comparand);
- } while(initial != comparand);
- return comparand;
-}
-
-#endif /* _MSC_VER < 1600 */
-
/* MSVC supports decltype keyword, but it's only supported on C++ and doesn't
* quite work here; and if a C++-only solution is worthwhile, then it would be
* better to use templates / function overloading, instead of decltype magic.