28.2.7 __builtin_btg

Description

This function will generate a btg machine instruction.

Some examples include:

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

struct foo {
  int16_t bit1:1;
} barbits;

int16_t bar;

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

  k = i;

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

 return j+k;
} 
Note: 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(uint16_t *, uint16_t 0xn);

Arguments

* – 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.

Machine Instruction

btg

Error Messages

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