[PATCH] Make `hash_long' function work if bits parameter is 0.

From: Miles Bader (miles@lsi.nec.co.jp)
Date: Fri Dec 06 2002 - 04:33:51 EST


If the bits parameter of hash_long (in <linux/hash.h>) is 0, then it
ends up right-shifting by BITS_PER_LONG, which is undefined in C (and
often is a nop).

This patch just handles that case explicitly.

diff -ruN -X../cludes ../orig/linux-2.5.50-uc0/include/linux/hash.h include/linux/hash.h
--- ../orig/linux-2.5.50-uc0/include/linux/hash.h 2002-09-18 09:59:18.000000000 +0900
+++ include/linux/hash.h 2002-12-06 13:22:00.000000000 +0900
@@ -27,6 +27,9 @@
 {
         unsigned long hash = val;
 
+ if (bits == 0)
+ return 0;
+
 #if BITS_PER_LONG == 64
         /* Sigh, gcc can't optimise this alone like it does for 32 bits. */
         unsigned long n = hash;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Dec 07 2002 - 22:00:26 EST