Closed Meinersbur closed 7 years ago
Negating a signed integer is undefined behaviour if it has the minimum value (as it cannot be represented in the integer of the that bit-size). Solution: Use unsigned negation.
See http://stackoverflow.com/questions/17313579/is-there-a-safe-way-to-get-the-unsigned-absolute-value-of-a-signed-integer-with
Thank you.
Negating a signed integer is undefined behaviour if it has the minimum value (as it cannot be represented in the integer of the that bit-size). Solution: Use unsigned negation.
See http://stackoverflow.com/questions/17313579/is-there-a-safe-way-to-get-the-unsigned-absolute-value-of-a-signed-integer-with