[Vm-dev] VM patches for oop comparison and usqInt declarations
David T. Lewis
lewis at mail.msen.com
Tue May 8 11:23:19 UTC 2007
On Mon, May 07, 2007 at 09:35:26PM -0400, Bert Freudenberg wrote:
> On May 7, 2007, at 17:25 , John M McIntosh wrote:
> >Ok, I was working with Craig a bit on this and I noticed for example.
> >usqInt endOfMemory;
> > sqInt fwdBlock2;
> > /* begin restoreHeadersAfterForwardBecome: */
> > fwdBlock2 = ((foo->endOfMemory + BaseHeaderSize) + 7) &
> > (WordMask - 7);
> > flag("Dan");
> > fwdBlock2 += BytesPerWord * 4;
> >Really shouldn't one consider that if a unsigned value gets
> >assigned to a signed integer one should really consider that a
> >possible problem?
> >Needless to say I believe the code above won't work as intended.
> Shooting from the hip and all, but I'd say thanks to two's complement
> this actually should work. Far from pretty or desirable, but it
> should generate the same code (unless the C compiler inserts specific
> checks which it should not and AFAIK it does not).
Right. Twos compliment arithetic does the right thing, and as near as
I can tell all oop addition and subtraction works correctly even if
the variables are declared sqInt.
More information about the Vm-dev