Fix Windows build errors.
Fix Windows build errors.
1.1 --- a/public/amtl/am-atomics.h Fri Aug 23 07:31:04 2013 -0400
1.2 +++ b/public/amtl/am-atomics.h Fri Aug 23 15:45:07 2013 -0700
1.3 @@ -39,8 +39,8 @@
1.4 long __cdecl _InterlockedIncrement(long volatile *dest);
1.5 long __cdecl _InterlockedDecrement(long volatile *dest);
1.6 }
1.7 -# pragma intrinsic(_InterlockedIncrement);
1.8 -# pragma intrinsic(_InterlockedDecrement);
1.9 +# pragma intrinsic(_InterlockedIncrement)
1.10 +# pragma intrinsic(_InterlockedDecrement)
1.11 #endif
1.12
1.13 template <size_t Width>
1.14 @@ -49,23 +49,25 @@
1.15 template <>
1.16 struct AtomicOps<4>
1.17 {
1.18 - typedef int Type;
1.19 +#if defined(_MSC_VER)
1.20 + typedef long Type;
1.21
1.22 -#if defined(_MSC_VER)
1.23 - static int Increment(int *ptr) {
1.24 + static Type Increment(Type *ptr) {
1.25 return _InterlockedIncrement(ptr);
1.26 }
1.27 - static int Decrement(int *ptr) {
1.28 + static Type Decrement(Type *ptr) {
1.29 return _InterlockedDecrement(ptr);
1.30 };
1.31 #elif defined(__GNUC__)
1.32 + typedef int Type;
1.33 +
1.34 // x86/x64 notes: When using GCC < 4.8, this will compile to a spinlock.
1.35 // On 4.8+, or when using Clang, we'll get the more optimal "lock addl"
1.36 // variant.
1.37 - static int Increment(int *ptr) {
1.38 + static Type Increment(Type *ptr) {
1.39 return __sync_add_and_fetch(ptr, 1);
1.40 }
1.41 - static int Decrement(int *ptr) {
1.42 + static Type Decrement(Type *ptr) {
1.43 return __sync_sub_and_fetch(ptr, 1);
1.44 }
1.45 #endif