]> Savannah Git Hosting - gnulib.git/commitdiff
intprops: tune INT_NEGATE_OVERFLOW for GCC 5 and 6
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 30 Aug 2016 19:29:21 +0000 (12:29 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 30 Aug 2016 19:30:49 +0000 (12:30 -0700)
* lib/intprops.h (INT_NEGATE_OVERFLOW): Tune for platforms like
GCC 5 and 6 that have __builtin_sub_overflow but not
__builtin_sub_overflow_p.  With the recent changes, these
platforms are a tiny bit faster with the INT_NEGATE_RANGE_OVERFLOW
implementation than with INT_SUBTRACT_OVERFLOW implementation,
since the former needs just one runtime comparison whereas the
latter needs two.

ChangeLog
lib/intprops.h

index 7d0cdbd8fda569273e12c39b029abe56cdfdb61d..5c9f404681fd0c956654ae44f3f6a15682ee8ce6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2016-08-30  Paul Eggert  <eggert@cs.ucla.edu>
 
+       intprops: tune INT_NEGATE_OVERFLOW for GCC 5 and 6
+       * lib/intprops.h (INT_NEGATE_OVERFLOW): Tune for platforms like
+       GCC 5 and 6 that have __builtin_sub_overflow but not
+       __builtin_sub_overflow_p.  With the recent changes, these
+       platforms are a tiny bit faster with the INT_NEGATE_RANGE_OVERFLOW
+       implementation than with INT_SUBTRACT_OVERFLOW implementation,
+       since the former needs just one runtime comparison whereas the
+       latter needs two.
+
        strverscmp: sync with glibc
        Although this doesn't exactly synchronize with glibc
        byte-for-byte, it makes the code behave the same as glibc.
index 744e64bf1bedd661bff6750565e911eac3bfa72e..4324e18c9343d4914c93d8a41cdb2fdf81d81e99 100644 (file)
@@ -330,7 +330,7 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX);
   _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW)
 #define INT_SUBTRACT_OVERFLOW(a, b) \
   _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW)
-#if _GL_HAS_BUILTIN_OVERFLOW || _GL_HAS_BUILTIN_OVERFLOW_P
+#if _GL_HAS_BUILTIN_OVERFLOW_P
 # define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a)
 #else
 # define INT_NEGATE_OVERFLOW(a) \