[OpenAFS] Strange access problems on one client

Carson Gaspar carson@taltos.org
Thu, 11 Oct 2007 20:02:58 -0400


Hans-Werner Paulsen wrote:
> On Sun, Oct 07, 2007 at 01:15:00PM -0400, Marc Dionne wrote:

>> +    else if (hval >= 1<<31)

> this patch is fine for architectures where the size of "unsigned long"
> is 4 bytes. But on the x86_64 architecture this will not work, because
> the size is 8 bytes. One can use "unsigned int".

Ummm... no. This whole thing is way too fragile. If you care about how 
many bits the variable has, you MUST use something like uint32_t. Or you 
can not care, and use sizeof() to generate your comparison. But you MUST 
NOT use "int" or "long" and hard-code bit shifts.

-- 
Carson