]> granicus.if.org Git - yasm/commitdiff
Move BitCount() macro from hamt.c to util.h.
authorPeter Johnson <peter@tortall.net>
Sun, 10 Mar 2002 20:21:50 +0000 (20:21 -0000)
committerPeter Johnson <peter@tortall.net>
Sun, 10 Mar 2002 20:21:50 +0000 (20:21 -0000)
svn path=/trunk/yasm/; revision=488

libyasm/hamt.c
libyasm/util.h
src/hamt.c
src/util.h
util.h

index eb4df1f3c68fca15cbe9f302b775476be0339dab..1f56bd1bc9a0a6c5b4349710288d8e4938eb634a 100644 (file)
@@ -58,19 +58,6 @@ struct HAMT {
     } while (0)
 #define GetSubTrie(n)          (HAMTNode *)((unsigned long)((n)->BaseValue)&~1UL)
 
-/* Bit-counting */
-#define SK5    0x55555555
-#define SK3    0x33333333
-#define SKF0   0x0F0F0F0F
-#define BitCount(d, s)         do {            \
-       d = s;                                  \
-       d -= (d>>1) & SK5;                      \
-       d = (d & SK3) + ((d>>2) & SK3);         \
-       d = (d & SKF0) + ((d>>4) & SKF0);       \
-       d += d>>16;                             \
-       d += d>>8;                              \
-    } while (0)
-
 static unsigned long
 HashKey(const char *key)
 {
index abd7f53941bc79cbc4f087ee8e9eb9ce1d82db94..2dbd480f26ed19c96361efce3db2dd5ccbdb729a 100644 (file)
@@ -135,6 +135,19 @@ int strncasecmp(const char *s1, const char *s2, size_t n);
 void xfree(/*@only@*/ /*@out@*/ /*@null@*/ void *p);
 #endif
 
+/* Bit-counting: used primarily by HAMT but also in a few other places. */
+#define SK5    0x55555555
+#define SK3    0x33333333
+#define SKF0   0x0F0F0F0F
+#define BitCount(d, s)         do {            \
+       d = s;                                  \
+       d -= (d>>1) & SK5;                      \
+       d = (d & SK3) + ((d>>2) & SK3);         \
+       d = (d & SKF0) + ((d>>4) & SKF0);       \
+       d += d>>16;                             \
+       d += d>>8;                              \
+    } while (0)
+
 #include "coretype.h"
 
 #include "valparam.h"
index eb4df1f3c68fca15cbe9f302b775476be0339dab..1f56bd1bc9a0a6c5b4349710288d8e4938eb634a 100644 (file)
@@ -58,19 +58,6 @@ struct HAMT {
     } while (0)
 #define GetSubTrie(n)          (HAMTNode *)((unsigned long)((n)->BaseValue)&~1UL)
 
-/* Bit-counting */
-#define SK5    0x55555555
-#define SK3    0x33333333
-#define SKF0   0x0F0F0F0F
-#define BitCount(d, s)         do {            \
-       d = s;                                  \
-       d -= (d>>1) & SK5;                      \
-       d = (d & SK3) + ((d>>2) & SK3);         \
-       d = (d & SKF0) + ((d>>4) & SKF0);       \
-       d += d>>16;                             \
-       d += d>>8;                              \
-    } while (0)
-
 static unsigned long
 HashKey(const char *key)
 {
index abd7f53941bc79cbc4f087ee8e9eb9ce1d82db94..2dbd480f26ed19c96361efce3db2dd5ccbdb729a 100644 (file)
@@ -135,6 +135,19 @@ int strncasecmp(const char *s1, const char *s2, size_t n);
 void xfree(/*@only@*/ /*@out@*/ /*@null@*/ void *p);
 #endif
 
+/* Bit-counting: used primarily by HAMT but also in a few other places. */
+#define SK5    0x55555555
+#define SK3    0x33333333
+#define SKF0   0x0F0F0F0F
+#define BitCount(d, s)         do {            \
+       d = s;                                  \
+       d -= (d>>1) & SK5;                      \
+       d = (d & SK3) + ((d>>2) & SK3);         \
+       d = (d & SKF0) + ((d>>4) & SKF0);       \
+       d += d>>16;                             \
+       d += d>>8;                              \
+    } while (0)
+
 #include "coretype.h"
 
 #include "valparam.h"
diff --git a/util.h b/util.h
index abd7f53941bc79cbc4f087ee8e9eb9ce1d82db94..2dbd480f26ed19c96361efce3db2dd5ccbdb729a 100644 (file)
--- a/util.h
+++ b/util.h
@@ -135,6 +135,19 @@ int strncasecmp(const char *s1, const char *s2, size_t n);
 void xfree(/*@only@*/ /*@out@*/ /*@null@*/ void *p);
 #endif
 
+/* Bit-counting: used primarily by HAMT but also in a few other places. */
+#define SK5    0x55555555
+#define SK3    0x33333333
+#define SKF0   0x0F0F0F0F
+#define BitCount(d, s)         do {            \
+       d = s;                                  \
+       d -= (d>>1) & SK5;                      \
+       d = (d & SK3) + ((d>>2) & SK3);         \
+       d = (d & SKF0) + ((d>>4) & SKF0);       \
+       d += d>>16;                             \
+       d += d>>8;                              \
+    } while (0)
+
 #include "coretype.h"
 
 #include "valparam.h"