Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在位移的帮助下启用 2 字节结构中的第二个字节?
我想要这个结果:
[x][x][x][x][x][x][x][x]|[ ][ ][ ][ ][ ][ ][ ][ ] [----- second byte ----]|[----- first byte -----]
这不起作用:
$options = 1 << 0xFF;
value << number_of_bits
所以
$options = 0xff << 8;
或者,
$options = 0xff00;
因为两个十六进制数字形成一个字节。