blob: 28668d839e9a2acef5868c255fd9228ee0fc45da [file] [log] [blame]
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#define __CRT__NO_INLINE
#include <windows.h>
/* for __x86_64 only */
LONG64 InterlockedAdd64(LONG64 volatile *Addend,LONG64 Value)
{
/* return InterlockedExchangeAdd64(Addend,Value) + Value; */
LONG64 ret;
__asm__ ("lock\n\t"
"xaddq %0,(%1)"
: "=r" (ret)
: "r" (Addend), "0" (Value)
: "memory");
return ret + Value;
}