Getting the upper 8bits of a value.
Hello, I know that HIWORD can be used to get the upper 16bits of a value. What can I use to get the upper 8bits? Can I just use HIWORD two times?
Thanks !
use >> and/or & operators
1 2 3 4
|
int byte[4];
int val = -1;
for(int i = 0; i < 4; i++)
byte[i] = (val >> i*4) & 0xFF;//I'm not sure about the operator precedence here..
|
Topic archived. No new replies allowed.