我有两个字节,8 位八位字节,应该读作:[3 位][4 位][3 位]。
例子:
unsigned char octet1 = 0b11111111; // binary values
unsigned char octet2 = 0b00000011;
作为整数:[7][15][7]。
任何人都可以提示我从哪里开始?
最佳答案
在一种pseudocode
octet1 = 0b11111111
octet2 = 0b00000011
word = octet1 | octet2<<8
n1 = word & 0b111
n2 = word>>3 & 0b1111
n3 = word>>7 & 0b111
关于c - C中2个字节代表3个整数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4096091/