Post 26 made on Monday July 30, 2007 at 03:30 |
Sogliphy Long Time Member |
Joined: Posts: | July 2007 186 |
|
|
sWORDs,
The expression '(calc >> 8)&0xff' yields the value of bits 9-15 of the integer representation of the value assigned to 'calc'. Bits 9 through 32 are first shifted right, this yields the value of bits 9-32. Then a bitwise AND is performed with 255, or 0xff, which is '11111111' in binary. This ensures that the result is constrained to values 0 to 255 (not strictly necessary in your case, since calc will never be bigger than 1277 (= (5 * 0xff) + 0x02) there, but a good habit anyway).
Finally, 'calc & 0xff' yields the value of bits 0-7 of the integer representation of the value assigned to 'calc'.
|
|
|