title: Is there an 8-bit atomic CAS (cmpxchg) intrinsic for X64 in Visual C++?
body: <p>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++?</p>
  
  <pre><code>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);
  }
  </code></pre>
  
  <p>The following instrinsics compile under Visual Studio C++</p>
  
  <pre><code>_InterlockedCompareExchange16
  _InterlockedCompareExchange
  _InterlockedCompareExchange64
  _InterlockedCompareExchange128
  </code></pre>
  
  <p>What I am looking for is something along the lines of</p>
  
  <pre><code>_InterlockedCompareExchange8
  </code></pre>
  
  <p>But that doesn't seem to exist.</p>