java : shift distance for int restricted to 31 bits -
any idea why shift distance int in java restricted 31 bits (5 lower bits of right hand operand)?
http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.19
x >>> n
i see similar question java bit operations >>> shift nobody pointed right answer
the shift distance restricted 31 bits because java int has 32 bits. shifting int
number more 32 bits produce same value (either 0 or 0xffffffff
, depending on initial value , shift operation use).
Comments
Post a Comment