aboutsummaryrefslogtreecommitdiff
path: root/include/hash.h
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-06-12 16:08:49 +0200
committervan Hauser <vh@thc.org>2020-06-12 16:08:49 +0200
commita632c00b0d023b8a40d09839fbb2662da1cb5d37 (patch)
tree3fc2bc1bebb24de5ce90d1ba9e265b7592f92e4c /include/hash.h
parentdb2e04361da8f40a7ee99fef1c2a2ed8f08b0501 (diff)
downloadAFLplusplus-a632c00b0d023b8a40d09839fbb2662da1cb5d37.tar.gz
switch to faster and better hash + random
Diffstat (limited to 'include/hash.h')
-rw-r--r--include/hash.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/include/hash.h b/include/hash.h
index cec51eac..09dabb59 100644
--- a/include/hash.h
+++ b/include/hash.h
@@ -30,9 +30,16 @@
#include "types.h"
-#ifdef __x86_64__
+u32 hash32(const void *key, u32 len, u32 seed);
+u64 hash64(const void *key, u32 len, u64 seed);
- #define ROL64(_x, _r) ((((u64)(_x)) << (_r)) | (((u64)(_x)) >> (64 - (_r))))
+#if 0
+
+The following code is disabled because xxh3 with a 32 bit resukt is 30% faster
+
+ #ifdef __x86_64__
+
+ #define ROL64(_x, _r) ((((u64)(_x)) << (_r)) | (((u64)(_x)) >> (64 - (_r))))
static inline u32 hash32(const void *key, u32 len, u32 seed) {
@@ -65,9 +72,9 @@ static inline u32 hash32(const void *key, u32 len, u32 seed) {
}
-#else
+ #else
- #define ROL32(_x, _r) ((((u32)(_x)) << (_r)) | (((u32)(_x)) >> (32 - (_r))))
+ #define ROL32(_x, _r) ((((u32)(_x)) << (_r)) | (((u32)(_x)) >> (32 - (_r))))
static inline u32 hash32(const void *key, u32 len, u32 seed) {
@@ -100,7 +107,8 @@ static inline u32 hash32(const void *key, u32 len, u32 seed) {
}
-#endif /* ^__x86_64__ */
+ #endif /* ^__x86_64__ */
+#endif
#endif /* !_HAVE_HASH_H */