summaryrefslogtreecommitdiffstats
path: root/scripts/include/hash.h
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/include/hash.h')
-rw-r--r--scripts/include/hash.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/include/hash.h b/scripts/include/hash.h
index ce2bc43b308b..efa904368a62 100644
--- a/scripts/include/hash.h
+++ b/scripts/include/hash.h
@@ -12,4 +12,17 @@ static inline unsigned int hash_str(const char *s)
return hash;
}
+/* simplified version of functions from include/linux/hash.h */
+#define GOLDEN_RATIO_32 0x61C88647
+
+static inline unsigned int hash_32(unsigned int val)
+{
+ return 0x61C88647 * val;
+}
+
+static inline unsigned int hash_ptr(const void *ptr)
+{
+ return hash_32((unsigned int)(unsigned long)ptr);
+}
+
#endif /* HASH_H */