Re: [PATCH] avoid negative (and full-width) shifts in radix-tree.c, take 3

2007-08-29 Thread Björn Steinbrink
On 2007.08.29 10:49:12 -0700, Christoph Lameter wrote: > On Wed, 29 Aug 2007, Peter Lund wrote: > > > > > - if (tmp >= RADIX_TREE_INDEX_BITS) > > - index = ~0UL; > > - return index; > > + if (shift < 0) > > + return ~0UL; > > + if (shift >= 8 * sizeof(unsigned long))

Re: [PATCH] avoid negative (and full-width) shifts in radix-tree.c, take 3

2007-08-29 Thread Christoph Lameter
On Wed, 29 Aug 2007, Peter Lund wrote: > > - if (tmp >= RADIX_TREE_INDEX_BITS) > - index = ~0UL; > - return index; > + if (shift < 0) > + return ~0UL; > + if (shift >= 8 * sizeof(unsigned long)) 8* sizeof(unsigned long) is the constant BITS_PER_LONG. - To

[PATCH] avoid negative (and full-width) shifts in radix-tree.c, take 3

2007-08-29 Thread Peter Lund
From: Peter Lund <[EMAIL PROTECTED]> Negative shifts are not allowed in C (the result is undefined). Same thing with full-width shifts. It works on most platforms but not on the VAX with gcc 4.0.1 (it results in an "operand reserved" fault). Applies to Linux 2.6.22. Signed-off-by: Peter Lund <[