【发布时间】:2015-05-25 23:57:50
【问题描述】:
如果我有,例如:
int32_t x = 572662306; /* 00100010001000100010001000100010 */
我想将两个最重要的字节存储在int8_t 中:
00100010 (base 2) = 34 (base 10)
或int16_t 中的四个最高有效字节:
0010001000100010 (base 2) = 8738 (base 10)
我该怎么做?
【问题讨论】:
-
你试过什么?你知道按位和移位运算符吗?标准 C 也不支持 4 位字节。你的意思是轻咬?
标签: c binary byte converter stdint