Silence a printf warning for %lu on 32bits archs.
[SXSI/libbp.git] / bp-utils.c
index b1d68ce..48b3fee 100644 (file)
@@ -1,13 +1,34 @@
 #include <stdio.h>
 #include "bp-utils.h"
 
+unsigned char popCount[] = {
+  0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,
+  1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
+  1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
+  2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
+  1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
+  2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
+  2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
+  3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
+  1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
+  2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
+  2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
+  3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
+  2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
+  3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
+  3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
+  4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8
+};
+
+
+
 static size_t allocated = 0;
 
 void * bp_malloc(size_t n)
 {
   void * res = malloc(n);
   if (!res) {
-    fprintf(stderr, __FILE__  ": failure to allocate %lu bytes\n", n);
+    fprintf(stderr, __FILE__  ": failure to allocate %lu bytes\n", (long unsigned int) n);
     exit(1);
   };
   allocated += n;