[PATCH] pseries: phyp dump: Variable size reserve space.

Segher Boessenkool segher at kernel.crashing.org
Thu Apr 10 13:10:59 EST 2008


>>>>> +	tmp = tmp & ~0x000000001FFFFFFF;
>>
>> Note that this only works as you expect because the constant is
>> signed here -- the extra zeroes do not magically make it a 64-bit
>> number.  So it goes 32-bit 0x1fffffff -> 32-bit -0x20000000 ->
>> 64-bit -0x20000000.
>
> Huh?  It's not big enough to be negative when considered as a 32-bit
> number...

0x1fffffff isn't, right; and that makes it a signed int.  Applying
the complement operator to it turns it negative.  And then the
implicit cast (because tmp is 64-bit) makes it 64-bit, still the
same negative value.  Which is the expected result, but via a way
too tricky (and fragile) path :-)


Segher




More information about the Linuxppc-dev mailing list