I am currently writing code where I need to change an 8 byte variable 1 bit at a time. I was wondering if there is a more convenient way to write a long but simple hex value, for example:
Variable and 0x8000000000000000
I know that I can declare char as 0x80 and then apply it to another type and shift it. I'm just looking for something simpler and more practical.
You can use the bitwise left shift operator to make it clearer:
variable & 1ULL << 63
well, although this is a shift, but you can use the arduino macro BV(), which is short and convenient:
BV()
#define _BV(bit) (1ULL << (bit))
:
var & (0x8 * _BV(60));
var & _BV(63);
63- .