The syntax "(1 << X)" is used extensively thought out AVR code and many other platform examples.
I'm just interested why.
IIUIC if X is a constant the shift left will get optimised out by the compiler to a number and will never be executed as a shift left instruction on the CPU. So why isn't it just a constant rather than a shift left constant ?
Consider this common pseudo code:
#define BIT6 6 [...] PORTB = (1 << BIT6);
Why isn't it usual to see:
#define BIT6 32 -- or 0b00100000 of you prefer [...] PORTB = BIT6;
To me the latter its easier to read. I'm just intrigued where the use of "(1 << X)" originated from ?
Jon.