Finally had a look at the implementation of this (in RE24). It is wrong. The following values produces these indexes, ordered as: 0: 0480000000 +1: 0480000001 -1: 04800000ff +257: 0480000101 -257: 048000feff To get the correct ordering, use normal (fully sign-extended) two's complement but with the sign bit inversed. (Same as value + max positive value + 1)