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

Rogier Wolff (R.E.Wolff@BitWizard.nl)
Sun, 8 Dec 2002 18:23:03 +0100


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?

Roger.

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +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 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/