[M3devel] TInt/TWord/m3back
Jay K
jay.krell at cornell.edu
Thu Feb 25 14:24:14 CET 2010
Tony, it should now be much closer to your intent.
I grant maybe the constants are misplaced, and I should try again to use ToBytes.
I'm worried though.
It used to be I could do:
TInt.Add(Int{4,FF,FF,FF,7}, One)
and be told it overflowed, in 4 bytes of precision.
Now it'll just do it in 8 and no overflow.
And chop always succeeds.
Maybe:
PROCEDURE CheckChop (VAR r: Int; n: CARDINAL) =
BEGIN
IF And (r [n-1], SignMask) = 0
THEN FOR i := n TO LAST(Int) DO IF r [i] # 0 THEN RETURN FALSE END; END;
ELSE FOR i := n TO LAST(Int) DO IF r [i] # Mask THEN RETURN FALSE END; END;
END;
RETURN TRUE;
END CheckChop;
?
- Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100225/d3135d42/attachment-0001.html>
More information about the M3devel
mailing list