]> Savannah Git Hosting - gnulib.git/commit
intprops: support unsigned *_WRAPV results
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 15 Aug 2019 00:43:46 +0000 (17:43 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 15 Aug 2019 00:44:22 +0000 (17:44 -0700)
commit8a7ac1d24ac54ca8f076320a61548c343040357b
tree8ab6f84120fd2e4a49d6d49c5f4297a20129a85e
parent5d791c6bbcf2b31b35450bd5a57f45ca66cb532f
intprops: support unsigned *_WRAPV results

Add support for unsigned, unsigned long, and unsigned long long
results to INT_ADD_WRAPV, INT_SUBTRACT_WRAPV, and
INT_MULTIPLY_WRAPV.  Also, work around GCC bug 91450, and fix a
bug with unsigned inputs reported by Eli Zaretskii in:
https://lists.gnu.org/r/bug-gnulib/2019-08/msg00012.html
* config/srclist.txt: Break the glibc connection for intprops.h
temporarily, while more testing is done in Gnulib-using apps.
* lib/intprops.h (INT_ADD_WRAPV, INT_SUBTRACT_WRAPV)
(INT_MULTIPLY_WRAPV, _GL_INT_OP_WRAPV, _GL_INT_OP_WRAPV_LONGISH):
Support unsigned results no narrower than unsigned int.  Report
overflow correctly if some arguments are unsigned.
(_GL_BUILTIN_MUL_OVERFLOW): New macro, to work around GCC bug 91450.
(_GL_INT_OP_CALC): Simplify now that the OVERFLOW argument does
the right thing with narrow args.
(_GL_INT_OP_CALC1): Remove.  All callers removed.
(_GL_INT_ADD_RANGE_OVERFLOW, _GL_INT_SUBTRACT_RANGE_OVERFLOW)
(_GL_INT_MULTIPLY_RANGE_OVERFLOW): New macros.
* tests/test-intprops.c: Check for bugs and test new behavior.
ChangeLog
config/srclist.txt
lib/intprops.h
tests/test-intprops.c