Stephan van Hulst wrote:Just take an int, set it to 255 and then cast it to a byte. The cast will lop off the three high order bytes, leaving you with the byte value -1 (which is the same as 255 unsigned).
If you like, you can also do it without an intermediate variable.
The compiler will know what you mean, and calculate the int value of 255 casted to a byte, and do it at compile time.... ie. no three higher order bytes to lop off.