The following code is possible in 32-bit Visual Studio C++. Is there a 64-bit equivalent using intrinsics since inline ASM isn't supported in the 64-bit version of Visual Studio C++?
FORCEINLINE bool bAtomicCAS8(volatile UINT8 *dest, UINT8 oldval, UINT8 newval)
{
bool result=false;
__asm
{
mov al,oldval
mov edx,dest
mov cl,newval
lock cmpxchg byte ptr [edx],cl
setz result
}
return(result);
}
The following instrinsics compile under Visual Studio C++
_InterlockedCompareExchange16
_InterlockedCompareExchange
_InterlockedCompareExchange64
_InterlockedCompareExchange128
What I am looking for is something along the lines of
_InterlockedCompareExchange8
But that doesn't seem to exist.