_bittestandcomplement, _bittestandcomplement64
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at _bittestandcomplement, _bittestandcomplement64.
Microsoft Specific**
Generate an instruction which examines bit b of the address a, returns its current value, and sets the bit to its complement.
unsigned char _bittestandcomplement( long *a, long b ); unsigned char _bittestandcomplement64( __int64 *a, __int64 b );
Parameters
[in, out] a
A pointer to the memory to examine.
[in] b
The bit position to test.
The bit at the position specified.
| Intrinsic | Architecture |
|---|---|
_bittestandcomplement | x86, ARM, x64 |
_bittestandcomplement64 | x64 |
Header file <intrin.h>
This routine is only available as an intrinsic.
// bittestandcomplement.cpp
// processor: x86, IPF, x64
#include <stdio.h>
#include <intrin.h>
#pragma intrinsic(_bittestandcomplement)
#ifdef _M_AMD64
#pragma intrinsic(_bittestandcomplement64)
#endif
int main()
{
long i = 1;
__int64 i64 = 0x1I64;
unsigned char result;
printf("Initial value: %d\n", i);
printf("Testing bit 1\n");
result = _bittestandcomplement(&i, 1);
printf("Value changed to %d, Result: %d\n", i, result);
#ifdef _M_AMD64
printf("Testing bit 0\n");
result = _bittestandcomplement64(&i64, 0);
printf("Value changed to %I64d, Result: %d\n", i64, result);
#endif
}
Initial value: 1 Testing bit 1 Value changed to 3, Result: 0 Testing bit 0 Value changed to 0, Result: 1
END Microsoft Specific
Show: