1
私は、私が持っている配列から2バイトをビットシフトしようとしていましたが、ときどき良い値で終わることがあります。ここに例があります。ビットシフト2バイトのcから配列
char buffer[2]; //current character buffer to store the bytes
unsigned int number; //the unsigned int to store values
number = buffer[0] << 8 | buffer[1]; //bitshifting
printf("%02x ", number);
場合によってはこのようになっているようです。 char
を整数に昇格したため
ffffffbc // the bc seems to be correct however the f's are not