in reply to Difference between Perl and Java for << operator?
Since Java integers are always signed and with sizes:
it seems to me the OP's Java code:
long HIGH_BITS = 0xFFFFFFFF << 28;is ill-advised because (as has been pointed out multiple times in this thread) 0xFFFFFFFF << 28 is intrinsically a 32-bit value, while a Java long is 64-bits. Though the OP's code presumably "works", surely it ought to have been written as:
int HIGH_BITS = 0xFFFFFFFF << 28;
In case the OP is still listening, I won't be able to sleep at night until I learn the backstory as to why the Java code chose a long rather than an int. :)
|
|---|