[M3commit] CVS Update: cm3
Jay K
jay.krell at cornell.edu
Wed Feb 10 17:52:07 CET 2010
xEQ should be EQ but I wasn't confident I wrote it correctly.
So the actual EQ computes three values, including xEQ, asserts they are all the same, and returns one of them.
Obviously a bit dumb, but I wasn't sure of myself and wanted something reasonably quickly so I could move on, and the obvious inefficiency wasn't/isn't a concern.
It should be fairly clear from the code.
- Jay
> From: hosking at cs.purdue.edu
> Date: Wed, 10 Feb 2010 10:23:08 -0500
> To: jkrell at elego.de
> CC: m3commit at elegosoft.com
> Subject: Re: [M3commit] CVS Update: cm3
>
> What does xEQ do exactly?
>
> PS You are stepping all over the work I have been doing to simplify TInt/TWord. So, be warned that your m3back code might break when I check things in.
>
> On 10 Feb 2010, at 14:46, Jay Krell wrote:
>
> > CVSROOT: /usr/cvs
> > Changes by: jkrell at birch. 10/02/10 14:46:28
> >
> > Modified files:
> > cm3/m3-sys/m3middle/src/: TWord.m3
> >
> > Log message:
> > Just remove the size check in Extract.
> > It appears it will just naturally treat the value as zero extended, which
> > is reasonable and allows the rest to work.
> >
> > This lets Tony's fix for initializing Longint work.
> > To be reapplied shortly.
> >
> > Deobfuscate Mask and Base here as well, like in TInt.
> >
> > Cleanup my TWord.xEQ function (still could use further cleanup, clearly,
> > once confidence is total)
> >
> > Index: src/TWord.m3
> > ===================================================================
> > RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.m3,v
> > retrieving revision 1.10
> > diff -u -r1.10 TWord.m3
> > --- src/TWord.m3 8 Feb 2010 08:33:20 -0000 1.10
> > +++ src/TWord.m3 10 Feb 2010 13:45:49 -0000
> > @@ -16,8 +16,8 @@
> > LShift = Word.LeftShift;
> >
> > CONST
> > - Mask = RShift (Word.Not (0), Word.Size - BITSIZE (IByte));
> > - Base = Mask + 1;
> > + Mask = 16_FF;
> > + Base = 16_100;
> >
> > (*------------------------------------------- unsigned integer operations ---*)
> >
> > @@ -278,8 +278,8 @@
> > BEGIN
> > <*ASSERT n # 0*>
> > FOR i := n-1 TO 0 BY -1 DO
> > - IF a.x[i] # b.x[i] THEN RETURN FALSE;
> > - ELSIF a.x[i] # b.x[i] THEN RETURN FALSE;
> > + IF a.x[i] # b.x[i] THEN
> > + RETURN FALSE;
> > END;
> > END;
> > FOR i := n TO a.n-1 DO IF a.x[i] # 0 THEN RETURN FALSE END END;
> > @@ -449,10 +449,7 @@
> >
> > PROCEDURE Extract (READONLY x: Int; i, n: CARDINAL; VAR r: Int): BOOLEAN =
> > VAR w, b: INTEGER;
> > - size := x.n * BITSIZE (IByte);
> > BEGIN
> > - IF i + n > size THEN RETURN FALSE; END;
> > -
> > RightShift (x, i, r);
> >
> > w := n DIV BITSIZE (IByte);
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3commit/attachments/20100210/912c4562/attachment-0002.html>
More information about the M3commit
mailing list