[Vm-dev] Re: CArray arithmetic methods...

Eliot Miranda eliot.miranda at gmail.com
Sat Oct 9 23:01:29 UTC 2010


On Sat, Oct 9, 2010 at 3:01 PM, Eliot Miranda <eliot.miranda at gmail.com>wrote:

> Hi All,
>
>     now I'm successfully simulating the LargeIntegers plugin I'm hitting
> what I consider a bug in CArray, used to model C pointers in the simulator.
>  The first problem is that CArray>>#+ & #- return an integer value, not
> another CArray,  (in C (char *)(exp) + n is still of type (char *), not int)
> and that the addition/subtraction doesn't scale by the unit size (in C (type
> *)p + n == (type *)((char *)p + n * sizeof(type))).  The second problem is
> that << >> * & // are meaningless on C pointers.  Anyone think of a good
> reason why I shouldn't a) rewrite CArray>>#+ & #- to read
>
> + n
> ^ self shallowCopy += (n * unitSize)
>
> - n
> ^ self shallowCopy -= (n * unitSize)
>
> (since e.g.
> += increment
>
> ptrOffset := ptrOffset + increment)
>
> and b) delete CArray>>#*, #//, #<<, #>>, #bitAnd:, #bitOr:, #bitShift: &
> #signedBitShift: ?
>

So far so good.  The only thing that broke was the use of
BitBltSimulator/BitBltSimulation>>#tableLookup:at: which can be deleted and
in
BitBltSimulation>>#pickSourcePixels:flags:srcMask:destMask:srcShiftInc:dstShiftInc:
rewrite
destPix := self tableLookup: cmLookupTable at: (sourcePix bitAnd: cmMask).
to
destPix := cmLookupTable at: (sourcePix bitAnd: cmMask).


> best
> Eliot
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20101009/414f248a/attachment.htm


More information about the Vm-dev mailing list