How to define a MACRO [closed]
How can I define a 40 bit MACRO.
For eg, if I want to define "deadbeef" (32 bit ) as a MACRO I'll do:
#define MYMACRO 0xdeadbeef
But how do I do it if I want to define "deadbeefs" ( 40 bits).
Thanks.
you can't because s can't be represented in 4 bits.
You can do the same using a 40 bits long constant. For example (on a 64bits architecture):
#define MYMACRO 0xdeadbeeffL
If requires your compiler and your architecture to have a type able to store more than 40 bits. Here I used the long int type which is long enough on 64 bits architectures.
Unfortunately C doesn't support base 29 literals.
精彩评论