Summary:
This is done by using the intrinsic directly instead.
This also marks the input parameter as `volatile`, to make it more clear that that's how it is handled by `_InterlockedExchangeAdd64`.
Reviewed By: yfeldblum
Differential Revision:
D3671320
fbshipit-source-id:
6010085ec3b6952a3eb1e952965ec6ad87566db2
#ifdef _WIN32
+#include <intrin.h>
#include <stdint.h>
#include <folly/Portability.h>
-// The intrinsics we need are in Windows.h :(
-#include <folly/portability/Windows.h>
-FOLLY_ALWAYS_INLINE int64_t __sync_fetch_and_add(int64_t* ptr, int64_t value) {
- return InterlockedExchangeAdd64(ptr, value);
+FOLLY_ALWAYS_INLINE
+int64_t __sync_fetch_and_add(volatile int64_t* ptr, int64_t value) {
+ return _InterlockedExchangeAdd64(ptr, value);
}
#endif