In C, shifting a signed integer does not have standard well-defined behaviour: right-shifting could 'shift in' a copy of the sign bit, or it could not.
Shifting signed integers is used in at least two places in the codebase in order to perform sign-extension. To avoid the use of shifting, sign extension is now instead achieved with two ANDs and a subtraction. The behaviour of this logic should be consistent across all platforms, improving this library's portability.
In C, shifting a signed integer does not have standard well-defined behaviour: right-shifting could 'shift in' a copy of the sign bit, or it could not.
https://stackoverflow.com/questions/4009885/arithmetic-bit-shift-on-a-signed-integer
Shifting signed integers is used in at least two places in the codebase in order to perform sign-extension. To avoid the use of shifting, sign extension is now instead achieved with two ANDs and a subtraction. The behaviour of this logic should be consistent across all platforms, improving this library's portability.