Super High Performance Pin I/O Technique

bobo1234:
I've dug into the Arduino internals and I have come across macros sbi() & cbi() and although they are functionally equivalent to sbi/cbi machine instructions they do not actually expand to those instructions.

Bullshit.

#define sbi(r,b)  r |= _BV(b)
#define cbi(r,b) r &= ~_BV(b)

void setup() 
{
  sbi( PORTB, 3 );
}

void loop() 
{
}
...
000000a6 <setup>:
  a6:	2b 9a       	sbi	0x05, 3	; 5
  a8:	08 95       	ret
...
1 Like