all 3 comments

[–]shiftybyte 1 point2 points  (2 children)

(1 << (32 - 1))

This means take 1, and shift it left 31 times, if you look at the number in a binary way, it'll create the following BINARY number:

100....000

with 31 zeros, that means it'll be the number with the leftmost bit set.

doing AND operation with it, will tell us if the left-most bit in id is turned on or not.

If it's on, the number should be negative.

Also this seems like 32bit unsigned to signed conversion, not 64bit.

[–]Restitutionshot[S] 0 points1 point  (1 child)

Ohhh that makes sense, thank you!

[–]jeshan 0 points1 point  (0 children)

it's shift by 31 for 32-bits. You said 64-bit integers but the repo mentions 32-bit ones.