* lib/popcount.h: Use verify_true instead of if...abort.
authorBen Pfaff <blp@gnu.org>
Tue, 24 Jul 2007 02:13:14 +0000 (02:13 +0000)
committerBen Pfaff <blp@gnu.org>
Tue, 24 Jul 2007 02:13:14 +0000 (02:13 +0000)
* modules/popcount: Depend on verify module.
Suggested by Jim Meyering.

ChangeLog
lib/popcount.h
modules/popcount

index f08030f..c8c539d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-07-23  Ben Pfaff  <blp@gnu.org>
+
+       * lib/popcount.h: Use verify_true instead of if...abort.
+       * modules/popcount: Depend on verify module.
+       Suggested by Jim Meyering.
+
 2007-07-23  Bruno Haible  <bruno@clisp.org>
 
        * gnulib-tool (func_import): Create a .cvsignore file also when the
index b7084cb..6c19de2 100644 (file)
 
 #include <limits.h>
 #include <stdlib.h>
+#include "verify.h"
 
 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR >= 4)
 #define POPCOUNT_CALCULATION(NAME, TYPE)        \
         return __builtin_##NAME (x);
 #else
-#define POPCOUNT_CALCULATION(NAME, TYPE)        \
-        int pop = popcount32 (x);               \
-        if (CHAR_BIT * sizeof (TYPE) > 32)      \
-          pop += popcount32 (x >> 31 >> 1);     \
-        if (CHAR_BIT * sizeof (TYPE) > 64)      \
-          abort ();                             \
+#define POPCOUNT_CALCULATION(NAME, TYPE)                        \
+        int pop = popcount32 (x);                               \
+        if (CHAR_BIT * sizeof (TYPE) > 32)                      \
+          pop += popcount32 (x >> 31 >> 1);                     \
+        (void) verify_true (CHAR_BIT * sizeof (TYPE) <= 64);    \
         return pop;
 
 /* Compute and return the population count of the low 32 bits of
index 885894d..45fd56b 100644 (file)
@@ -7,6 +7,7 @@ m4/popcount.m4
 
 Depends-on:
 inline
+verify
 
 configure.ac:
 gl_POPCOUNT