summaryrefslogtreecommitdiffstats
path: root/include/linux/hash.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/hash.h')
-rw-r--r--include/linux/hash.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/hash.h b/include/linux/hash.h
index b80506bdd733..24df9e70406f 100644
--- a/include/linux/hash.h
+++ b/include/linux/hash.h
@@ -67,4 +67,14 @@ static inline unsigned long hash_ptr(const void *ptr, unsigned int bits)
{
return hash_long((unsigned long)ptr, bits);
}
+
+static inline u32 hash32_ptr(const void *ptr)
+{
+ unsigned long val = (unsigned long)ptr;
+
+#if BITS_PER_LONG == 64
+ val ^= (val >> 32);
+#endif
+ return (u32)val;
+}
#endif /* _LINUX_HASH_H */
OpenPOWER on IntegriCloud