changeset 9120:af87f682cfec

* lib/popcount.h: Use verify_true instead of if...abort. * modules/popcount: Depend on verify module. Suggested by Jim Meyering.
author Ben Pfaff <blp@gnu.org>
date Tue, 24 Jul 2007 02:13:14 +0000
parents 9ce8d438ff3d
children 2b6b38e4a82e
files ChangeLog lib/popcount.h modules/popcount
diffstat 3 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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
--- a/lib/popcount.h
+++ b/lib/popcount.h
@@ -22,17 +22,17 @@
 
 #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
--- a/modules/popcount
+++ b/modules/popcount
@@ -7,6 +7,7 @@
 
 Depends-on:
 inline
+verify
 
 configure.ac:
 gl_POPCOUNT