union foo {
byte java[2];
int sucks;
}
void myfunc()
{
union foo bar;
int stuf;
bar.java[0] = 0;
bar.java[1] = -1;
stuff = bar.sucks;
}
Originally posted by: Jumpem
What does the "<< 8" portion do in your example?
int temp = ((int)tmpByte[0] << 8) + (tmpByte[1] & 0xff);
Ensure that any garbage in the upper byte is cleaned off before use.Originally posted by: Jumpem
Ok, I understand that. What does the "& 0xff" portion do?