8.9.11 builtin_avr_swap Built-in Function

Inserts a swap nibble swap instruction sequence.

Prototype

unsigned char __builtin_avr_swap(unsigned char)

Remarks

The built-in will produce code that loads the operands to appropriate registers, performs the nibble swap, and stores the result.

Example

int main(void) {
  uint8_t a;
  uint8_t result;
    
  a = 0x81;
  result = __builtin_avr_swap(a);  // result will be 0x18
}