[M3commit] CVS Update: cm3

Jay K jay.krell at cornell.edu
Wed Feb 10 18:56:01 CET 2010


I don't think they are the same.

 

TInt.EQ(Int{1,{16_FF}}, Int{2,{16_FF,16_FF}) => true, they are both -1

TWord.EQ(Int{1,{16_FF}}, Int{2,{16_FF,16_FF}) => false, they are 255 and 65535.

 

But maybe I'm confused. I should just test the above but not now.

I guess..it'd help if n was a constant, always 8.

Then TInt.EQ would work, and the CheckSign business would be gone/simpler.

Except then, we'd know, all other beings equal, initialization would be horribly broken.

 I don't fully understand that, but we need a 4 byte value.

 

 - Jay
 


Subject: Re: [M3commit] CVS Update: cm3
From: hosking at cs.purdue.edu
Date: Wed, 10 Feb 2010 12:49:32 -0500
CC: jkrell at elego.de; m3commit at elegosoft.com
To: jay.krell at cornell.edu

But why do you need it.  Just use TInt.EQ.






Antony Hosking | Associate Professor | Computer Science | Purdue University
305 N. University Street | West Lafayette | IN 47907 | USA
Office +1 765 494 6001 | Mobile +1 765 427 5484



On 10 Feb 2010, at 11:52, Jay K wrote:

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/e68239d1/attachment-0002.html>


More information about the M3commit mailing list