Re: Ext2 patches

Linus Torvalds (torvalds@transmeta.com)
Sat, 4 Apr 1998 09:35:18 -0800 (PST)


On Sat, 4 Apr 1998, Joseph Malicki wrote:
>
> A long expression >> 32 does have a defined value on the i386...... 0.Joe

Nope. Try again - write a small test to do this (and don't use a
_constant_ 32, because a constant 32 will be noticed by the compiler, and
because it is undefined behaviour the compiler is free to do whatever it
wants to (gcc _happens_ to return 0).

Linus

-----
unsigned long test(unsigned long val, int shift)
{
return val >> shift;
}

int main(int argc)
{
printf("%08lx\n", test(~0UL, 32));
printf("%08lx\n", (~0UL) >> 32);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu