Format
#include <builtin.h>unsigned int __smp_bts(unsigned int *pBits, unsigned int bit)
Language Level: None
__smp_bts tests and sets a bit within a 4 byte memory operand.
The address of the memory operand is pBits and the bit
number is bit. Bits are numbered 0 through 31 with 0
being the least significant bit. The test and set operation is
atomic even on multi-processor machines.
Return Value
The original value of the selected bit is returned as an
unsigned integer.
Example
This example tests and sets bit 4 in an unsigned
integer.
#include <stdio.h> #include <builtin.h>
unsigned int mem = 0xFFFFFFEF;
int main(void)
{
if (!__smp_bts(&mem, 4))
{
printf("Bit 4 should now be one.\n");
}
printf("mem = %x\n", mem);
/***************************************
The output should be:
Bit 4 should now be one.
mem = 0xFFFFFFFF
***************************************/
return 0; }
![]()
__btr -- Test and Reset a Bit
__bts -- Test and Set a Bit
__smp_btr -- Bit Test and Reset Atomically