The documentation for _InterlockedCompareExchange
says for every parameter
The sign is ignored.
So does it mean that numbers like 0xffff
and 0x7fff
(for 16-bit version) will be considered equal by _InterlockedCompareExchange16
etc. by other width intrinsics? Or does this mean that the intrinsics accept both signed and unsigned integers? Or something else?
If it's not a bug in the documentation, it seems at least ambiguous.
the
_InterlockedCompareExchange
this is compiler intrinsic implemented asCMPXCHG
instruction. theThe sign is ignored
mean that when we compare 2 integers for equal only - no different how we interpret high bit - as sign bit or no. this affected only compare for>
or<
but not for=
. and0xffff
of course not equal to0x7fff