Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5181

Java • Re: Java Help with bitwise operators

$
0
0
The stored data type is "byte"

Code:

byte[] data = new byte[2];
Can I assume this is unsigned 8 bits like uint8_t in C ?
If so, the & 0xFF mask in "(data[0] & 0xFF)" seems pointless but harmless (no risk of sign extension).
The C compiler simply removes things like this !!!

Statistics: Posted by jahboater — Wed Jul 31, 2024 11:32 am



Viewing all articles
Browse latest Browse all 5181

Trending Articles