[Vm-dev] CArray arithmetic methods...

Eliot Miranda eliot.miranda at gmail.com
Sat Oct 9 22:01:03 UTC 2010


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: ?

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


More information about the Vm-dev mailing list