Add (not technically necessary 0xFF guard for clarity).
Without this, the byte is cast as follows (in bits) if the top byte is set: 10000010 -> 1000000000000000000000000000010 This works because we then always shift at least one bit left, and only look at the bottom 8 bits of the result. It's confusing though. It's clearer if the cast to int gives just adds zeros to the front, like: 10000010 -> 0000000000000000000000010000010
Showing
with
1 additions
and
1 deletions
Please
register
or
sign in
to comment