[OpenBIOS] [PATCH v5 3/5] Pretty-print reg property

Segher Boessenkool segher at kernel.crashing.org
Sat Nov 13 00:44:33 CET 2010


>>> Your loop uses them as signed numbers though...
>>
>> "My loop"?
>
> Your optimized version of my .p-reg word - iiuc - uses a loop counter
> going from + my-#acells to - my-#scells, thereby treating the property
> values as signed numbers on sparc32, ppc, ppc64 (where cell size == 4).

It doesn't treat them as signed; it does however assume #a + #s fits in
a single cell, without overflow :-)

Open Firmware requires two's complement arithmetic, so you can treat
all arithmetic (except signed division) as unsigned.  Quite handy.

My loop used a biased index so that it could test for the "middle"
condition by testing against zero, which saves some stack juggling;
it's just a little trick, there's no special meaning to it.

> Practically speaking it doesn't matter though since I haven't seen
> such large #size-cells anywhere yet. :)

Yeah :-)


Segher




More information about the OpenBIOS mailing list