Test whether unsigned number is < 0

Niels Möller nisse at lysator.liu.se
Sat Feb 23 17:59:20 CET 2013

Nicolas Roeser <nicolas.roeser at uni-ulm.de> writes:

> The problem is that an unsigned number is always >=0, so the test
> (small_mult < 0) always evaluates to 0. When compiling GMP with
> gcc-4.7.2 and -Werror=type-limits, the build breaks there.

I guess -Werror is not supported... Is this the only warning you get?

It shouldn't be too hard to fix, replace (small_mult < 0) by
SMALL_NEGATIVE_P(small_mult), and add

  #define SMALL_NEGATIVE_P(x) ((x) < 0)


  #define SMALL_NEGATIVE_P(x) 0

depending on the operation. Not sure if it's worth fixing or not.


Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.

More information about the gmp-bugs mailing list