summaryrefslogtreecommitdiff
path: root/includes/General.h
diff options
context:
space:
mode:
Diffstat (limited to 'includes/General.h')
-rw-r--r--includes/General.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/includes/General.h b/includes/General.h
index 6f423ed..2b645c9 100644
--- a/includes/General.h
+++ b/includes/General.h
@@ -4,4 +4,9 @@
#define MAX(__a,__b) ((__a)<(__b)?(__b):(__a))
#define MIN(__a,__b) ((__a)>(__b)?(__b):(__a))
+#define BITCOUNT(x) (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255)
+#define BX_(x) ((x) - (((x)>>1)&0x77777777) \
+ - (((x)>>2)&0x33333333) \
+ - (((x)>>3)&0x11111111))
+
#endif