[M3commit] CVS Update: cm3

Tony Hosking hosking at cs.purdue.edu
Wed Feb 10 16:23:08 CET 2010


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);




More information about the M3commit mailing list