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

From: Rogier Wolff (
Date: Sun Dec 08 2002 - 12:23:03 EST

On Fri, Dec 06, 2002 at 08:37:26AM -0800, Linus Torvalds wrote:
> 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.

Wouldn't it be nice to have a memory-for-speed tradeoff by being able
to set the bits-in-the-hash-table to zero?


** ** ** +31-15-2600998 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
* The Worlds Ecosystem is a stable system. Stable systems may experience *
* excursions from the stable situation. We are currently in such an      * 
* excursion: The stable situation does not include humans. ***************
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Sun Dec 15 2002 - 22:00:13 EST