diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2020-08-04 22:58:58 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-08-04 22:58:58 -0700 |
commit | 7279f0a282283db04352e247c3bdb39ee03d10f6 (patch) | |
tree | d53f8741eaf9443c02c702619c2e0c2b4f8d8f2b /include/intprops.h | |
parent | 4c56bcbceb05b44965d48e701711f850b83d7c69 (diff) | |
download | glibc-7279f0a282283db04352e247c3bdb39ee03d10f6.tar.gz glibc-7279f0a282283db04352e247c3bdb39ee03d10f6.tar.xz glibc-7279f0a282283db04352e247c3bdb39ee03d10f6.zip |
Sync intprops.h from Gnulib
* include/intprops.h: Sync from Gnulib. This improves performance of INT_MULTIPLY_WRAPV on recent GCC, which affects glibc only in the support library.
Diffstat (limited to 'include/intprops.h')
-rw-r--r-- | include/intprops.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/include/intprops.h b/include/intprops.h index 0c379a8c5b..6de65b067d 100644 --- a/include/intprops.h +++ b/include/intprops.h @@ -373,12 +373,17 @@ _GL_INT_OP_WRAPV (a, b, r, -, _GL_INT_SUBTRACT_RANGE_OVERFLOW) #endif #if _GL_HAS_BUILTIN_MUL_OVERFLOW -/* Work around GCC bug 91450. */ -# define INT_MULTIPLY_WRAPV(a, b, r) \ - ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && EXPR_SIGNED (a) && EXPR_SIGNED (b) \ - && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) \ - ? ((void) __builtin_mul_overflow (a, b, r), 1) \ - : __builtin_mul_overflow (a, b, r)) +# if (9 < __GNUC__ + (3 <= __GNUC_MINOR__) \ + || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__)) +# define INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r) +# else + /* Work around GCC bug 91450. */ +# define INT_MULTIPLY_WRAPV(a, b, r) \ + ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && EXPR_SIGNED (a) && EXPR_SIGNED (b) \ + && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) \ + ? ((void) __builtin_mul_overflow (a, b, r), 1) \ + : __builtin_mul_overflow (a, b, r)) +# endif #else # define INT_MULTIPLY_WRAPV(a, b, r) \ _GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW) |