| Index: Source/wtf/Atomics.h
|
| diff --git a/Source/wtf/Atomics.h b/Source/wtf/Atomics.h
|
| index fb36bf6fb042a60996f0b929c3fc58b377e696c4..980f6fc275df5ae94effd28a1269b3e7cc1cecab 100644
|
| --- a/Source/wtf/Atomics.h
|
| +++ b/Source/wtf/Atomics.h
|
| @@ -54,14 +54,34 @@ namespace WTF {
|
| // atomicAdd returns the result of the addition.
|
| ALWAYS_INLINE int atomicAdd(int volatile* addend, int increment)
|
| {
|
| - return InterlockedExchangeAdd(reinterpret_cast<long volatile*>(addend), static_cast<long>(increment)) + increment;
|
| + return InterlockedExchangeAdd(reinterpret_cast<LONG volatile*>(addend), static_cast<LONG>(increment)) + increment;
|
| }
|
| +ALWAYS_INLINE unsigned long atomicAdd(unsigned long volatile* addend, unsigned long increment)
|
| +{
|
| + return InterlockedExchangeAdd(reinterpret_cast<ULONG volatile*>(addend), static_cast<LONG>(increment)) + increment;
|
| +}
|
| +#if defined(_WIN64)
|
| +ALWAYS_INLINE unsigned long long atomicAdd(unsigned long long volatile* addend, unsigned long long increment)
|
| +{
|
| + return InterlockedExchangeAdd64(reinterpret_cast<ULONGLONG volatile*>(addend), static_cast<LONGLONG>(increment)) + increment;
|
| +}
|
| +#endif
|
|
|
| // atomicSubtract returns the result of the subtraction.
|
| ALWAYS_INLINE int atomicSubtract(int volatile* addend, int decrement)
|
| {
|
| - return InterlockedExchangeAdd(reinterpret_cast<long volatile*>(addend), static_cast<long>(-decrement)) - decrement;
|
| + return InterlockedExchangeAdd(reinterpret_cast<LONG volatile*>(addend), static_cast<LONG>(-decrement)) - decrement;
|
| }
|
| +ALWAYS_INLINE unsigned long atomicSubtract(unsigned long volatile* addend, unsigned long decrement)
|
| +{
|
| + return InterlockedExchangeAdd(reinterpret_cast<ULONG volatile*>(addend), static_cast<LONG>(-decrement)) - decrement;
|
| +}
|
| +#if defined(_WIN64)
|
| +ALWAYS_INLINE unsigned long long atomicSubtract(unsigned long long volatile* addend, unsigned long long decrement)
|
| +{
|
| + return InterlockedExchangeAdd64(reinterpret_cast<ULONGLONG volatile*>(addend), static_cast<LONGLONG>(-decrement)) - decrement;
|
| +}
|
| +#endif
|
|
|
| ALWAYS_INLINE int atomicIncrement(int volatile* addend) { return InterlockedIncrement(reinterpret_cast<long volatile*>(addend)); }
|
| ALWAYS_INLINE int atomicDecrement(int volatile* addend) { return InterlockedDecrement(reinterpret_cast<long volatile*>(addend)); }
|
| @@ -86,8 +106,12 @@ ALWAYS_INLINE void atomicSetOneToZero(int volatile* ptr)
|
|
|
| // atomicAdd returns the result of the addition.
|
| ALWAYS_INLINE int atomicAdd(int volatile* addend, int increment) { return __sync_add_and_fetch(addend, increment); }
|
| +ALWAYS_INLINE unsigned long atomicAdd(unsigned long volatile* addend, unsigned long increment) { return __sync_add_and_fetch(addend, increment); }
|
| +ALWAYS_INLINE unsigned long long atomicAdd(unsigned long long volatile* addend, unsigned long long increment) { return __sync_add_and_fetch(addend, increment); }
|
| // atomicSubtract returns the result of the subtraction.
|
| ALWAYS_INLINE int atomicSubtract(int volatile* addend, int decrement) { return __sync_sub_and_fetch(addend, decrement); }
|
| +ALWAYS_INLINE unsigned long atomicSubtract(unsigned long volatile* addend, unsigned long decrement) { return __sync_sub_and_fetch(addend, decrement); }
|
| +ALWAYS_INLINE unsigned long long atomicSubtract(unsigned long long volatile* addend, unsigned long long decrement) { return __sync_sub_and_fetch(addend, decrement); }
|
|
|
| ALWAYS_INLINE int atomicIncrement(int volatile* addend) { return atomicAdd(addend, 1); }
|
| ALWAYS_INLINE int atomicDecrement(int volatile* addend) { return atomicSubtract(addend, 1); }
|
|
|