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

From: Linus Torvalds (torvalds@transmeta.com)
Date: Fri Dec 06 2002 - 11:37:26 EST


On Fri, 6 Dec 2002, Miles Bader wrote:
>
> 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).

I would much rather just add a comment saying that "bits" had better be in
a valid range. There are no valid uses for a 0-bit hash table that I can
see, and undefined behaviour for undefined operations is fine with me.

                Linus

-
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:27 EST