Michael Schierl wrote:
Aeloria Resa schrieb:

It's casting 0xFF, not 0x80, but anyways. Umm, why'd you replace it with
1s? When it get's cast, I was under the impression that, like everything
else, it pads it with 0s.


casting preserves the sign of a value. e.g. a "negative" byte 0xAB is
cast to int 0xFFFFFFAB, an int
0xABCD1234 is cast to long 0xFFFFFFFFABCD1234. Positive bytes like 0x42
are cast to 0x00000042 etc.

In other words, the most significant bit (the "sign bit") of the source
is used to fill the destination.

the number -2 e.g. is 0xFE as byte 0xFFFFFFFE as int, 0xFFFFFFFFFFFFFFFE
as long.

in java there is no such thing as an unsigned byte/integer/long.

mihi

_______________________________________________
devl mailing list
[EMAIL PROTECTED]
http://hawk.freenetproject.org:8080/cgi-bin/mailman/listinfo/devl


That rather explains it. It also maks me want to smash Java to itty bitty little infinitesimal bits. (Or bytes, but they're a bit too large. Java might get back up, like the zombie it is.)


_______________________________________________
devl mailing list
[EMAIL PROTECTED]
http://hawk.freenetproject.org:8080/cgi-bin/mailman/listinfo/devl

Reply via email to