I was trying to format some 16 bit constants in binary format and noticed that the handy binary formatter "B" seems to work only on bytes and not ints (16 bits).
Paul Badger
I was trying to format some 16 bit constants in binary format and noticed that the handy binary formatter "B" seems to work only on bytes and not ints (16 bits).
Paul Badger
As a workaround you can do this:
int x = (B11111111 << 8) | B00000000;
This will get you the same thing as if "B1111111100000000" existed.
it seems that these formaters are just defined constant :
#define B11111110 254
#define B11111111 255
in binary.h
so you could also define your own set, I suppose, for a whole 16bit integer. Don't forget to add some zeros, like here :
#define B1000 8
#define B01000 8
#define B001000 8
#define B0001000 8
#define B00001000 8
That would be a lot of constants !!