28.2.5 __builtin_btg

Description

This function will generate a btg machine instruction.

Some examples include:

int i; /* near by default */
int l attribute((far));

struct foo {
  int bit1:1;
} barbits;

int bar;

void some_bittoggles() {
  register int j asm("w9");
  int k;

  k = i;

  __builtin_btg(&i,1);
  __builtin_btg(&j,3);
  __builtin_btg(&k,4);
  __builtin_btg(&l,11);

 return j+k;
} 

Note that taking the address of a variable in a register will produce warning by the compiler and cause the register to be saved onto the stack (so that its address may be taken); this form is not recommended. This caution only applies to variables explicitly placed in registers by the programmer.

Prototype

void __builtin_btg(unsigned int *, unsigned int 0xn);

Argument

* – A pointer to the data item for which a bit should be toggled.

0xn – A literal value in the range of 0 to 15.

Return Value

Returns a btg machine instruction.

Assembler Operator/ Machine Instruction

btg

Error Messages

An error message will be displayed if the parameter values are not within range.