]> Savannah Git Hosting - gnulib.git/commit
intprops: port better to GCC 7
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 24 Jun 2016 11:35:12 +0000 (13:35 +0200)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 24 Jun 2016 11:35:52 +0000 (13:35 +0200)
commit406465c5986477fbaa8b4e33df596d9c6720a80f
tree91f48587412f804dba143920c547624870431884
parent5050ee058cefb0bb7ac6f15b726a83fe4d590ed9
intprops: port better to GCC 7

GCC 7 __builtin_add_overflow supports a new usage form, where the
last argument is a null pointer, and which merely returns 1 if an
overflow would occur.  This is a constant expression if all
arguments are constants, and should generate faster code when code
needs to be generated.
* lib/intprops.h (_GL_HAS_BUILTIN_OVERFLOW_WITH_NULL): New macro.
(_GL_ADD_OVERFLOW, _GL_SUBTRACT_OVERFLOW, _GL_MULTIPLY_OVERFLOW):
Use builtin operations if available.
(INT_NEGATE_OVERFLOW): Prefer INT_SUBTRACT_OVERFLOW if builtin
operations are available, as it's almost surely faster.
ChangeLog
lib/intprops.h