My function works mainly with long (Int64) and speed is not a big problem.
Sorry for being lazy to do it myself and thanks in advance for any helps!
The unsigned right shift operator is defined from Java doc as the following:
Code: Select all
The value of n >>> s is n right-shifted s bit positions with zero-extension, where:
- If n is positive, then the result is the same as that of n >> s.
- If n is negative and the type of the left-hand operand is int, then the result is equal to that of the expression (n >> s) + (2 << ~s).
- If n is negative and the type of the left-hand operand is long, then the result is equal to that of the expression (n >> s) + (2L << ~s).
The added term (2 << ~s) or (2L << ~s) cancels out the propagated sign bit.
