intprops: add safe, portable integer overflow checking
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 15 May 2011 16:35:12 +0000 (09:35 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 15 May 2011 16:38:23 +0000 (09:38 -0700)
commite873fd36a6866bc8ee05c83bf61e140d4b499905
treec4888bf98b4db21cd4c5fe9bd41d6ed7d428cba3
parent533fd9cee8195db5cfa76b30fd0c6bcee583163c
intprops: add safe, portable integer overflow checking

* lib/intprops.h (_GL_INT_CONVERT, _GL_INT_TWOS_COMPLEMENT):
(_GL_INT_SIGNED, _GL_INT_MINIMUM, _GL_INT_MAXIMUM):
(_GL_SIGNED_INT_MINIMUM, INT_ADD_RANGE_OVERFLOW):
(INT__SUBTRACT__RANGE_OVERFLOW, INT_NEGATE_RANGE_OVERFLOW):
(INT_MULTIPLY_RANGE_OVERFLOW, INT_REMAINDER_RANGE_OVERFLOW):
(INT_LEFT_SHIFT_RANGE_OVERFLOW, _GL_ADD_OVERFLOW):
(_GL__SUBTRACT__OVERFLOW, _GL_MULTIPLY_OVERFLOW, _GL_DIVIDE_OVERFLOW):
(_GL_REMAINDER_OVERFLOW, _GL_UNSIGNED_NEG_MULTIPLE, INT_ADD_OVERFLOW):
(INT__SUBTRACT__OVERFLOW, INT_NEGATE_OVERFLOW, INT_MULTIPLY_OVERFLOW):
(INT_DIVIDE_OVERFLOW, INT_REMAINDER_OVERFLOW):
(INT_LEFT_SHIFT_OVERFLOW, _GL_BINARY_OP_OVERFLOW): New macros.
ChangeLog
lib/intprops.h