Reputation: 25965
How do I enable the second byte in 2 byte structure with help of bit shifting?
I want this result:
[x][x][x][x][x][x][x][x]|[ ][ ][ ][ ][ ][ ][ ][ ]
[----- second byte ----]|[----- first byte -----]
This is not working:
$options = 1 << 0xFF;
Upvotes: 0
Views: 157
Reputation: 224983
value << number_of_bits
So
$options = 0xff << 8;
Alternatively,
$options = 0xff00;
since two hexadecimal digits form one byte.
Upvotes: 2