开发者

How to define a MACRO [closed]

开发者_如何学Go It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜