<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Here is the suggested change. Ok?<br><br>Index: m3middle/src/TInt.i3<br>===================================================================<br>RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TInt.i3,v<br>retrieving revision 1.34<br>diff -u -r1.34 TInt.i3<br>--- m3middle/src/TInt.i3    15 Dec 2010 16:10:46 -0000    1.34<br>+++ m3middle/src/TInt.i3    18 Dec 2012 18:43:44 -0000<br>@@ -33,8 +33,8 @@<br>   Max16  = Int{16_FF, 16_7f, 16_00,..};<br>   Min32  = Int{16_00, 16_00, 16_00, 16_80, 16_FF,..};<br>   Max32  = Int{16_FF, 16_FF, 16_FF, 16_7f, 16_00,..};<br>-  Min64  = Int{16_00, 16_00, 16_00, 16_00, 16_00, 16_00, 16_00, 16_80};<br>-  Max64  = Int{16_FF, 16_FF, 16_FF, 16_FF, 16_FF, 16_FF, 16_FF, 16_7f};<br>+  Min64  = Int{16_00, 16_00, 16_00, 16_00, 16_00, 16_00, 16_00, 16_80, 16_FF};<br>+  Max64  = Int{16_FF, 16_FF, 16_FF, 16_FF, 16_FF, 16_FF, 16_FF, 16_7f, 0};<br> <br> PROCEDURE FromInt (x: INTEGER;  VAR i: Int): BOOLEAN;<br> (* converts a host integer 'x' to a target integer 'i' *)<br>Index: m3middle/src/TWord.i3<br>===================================================================<br>RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/TWord.i3,v<br>retrieving revision 1.11<br>diff -u -r1.11 TWord.i3<br>--- m3middle/src/TWord.i3    27 Feb 2010 00:43:06 -0000    1.11<br>+++ m3middle/src/TWord.i3    18 Dec 2012 18:43:44 -0000<br>@@ -26,7 +26,7 @@<br>   Max8  = Int{16_FF, 0, ..};<br>   Max16 = Int{16_FF, 16_FF, 0, ..};<br>   Max32 = Int{16_FF, 16_FF, 16_FF, 16_FF, 0, ..};<br>-  Max64 = Int{16_FF, 16_FF, 16_FF, 16_FF, 16_FF, 16_FF, 16_FF, 16_FF};<br>+  Max64 = Int{16_FF, 16_FF, 16_FF, 16_FF, 16_FF, 16_FF, 16_FF, 16_FF, 0};<br> <br> PROCEDURE New (READONLY chars: ARRAY OF CHAR;  base: [2..16];<br>                VAR i: Int): BOOLEAN;<br>Index: m3middle/src/Target.i3<br>===================================================================<br>RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/Target.i3,v<br>retrieving revision 1.70<br>diff -u -r1.70 Target.i3<br>--- m3middle/src/Target.i3    4 Sep 2012 15:11:09 -0000    1.70<br>+++ m3middle/src/Target.i3    18 Dec 2012 18:43:44 -0000<br>@@ -224,7 +226,7 @@<br>    element of the array. *)<br> <br> TYPE<br>-  Int = (* OPAQUE *) ARRAY [0..7] OF IByte;<br>+  Int = (* OPAQUE *) ARRAY [0..8] OF IByte;<br>   IByte = BITS 8 FOR [0..16_ff];<br> <br> TYPE<br><br><br>As a follow up, TWord could change so that many but not all of its procedure are just constants assigned from TInt.<br>i.e.<br>INTERFACE TWord;<br><br>CONST LT = TInt.LT;<br><br> - Jay<br><br><br><div><div id="SkyDrivePlaceholder"></div><hr id="stopSpelling">From: jay.krell@cornell.edu<br>To: m3devel@elegosoft.com<br>Subject: suggested Target.Int change<br>Date: Thu, 13 Dec 2012 08:32:27 +0000<br><br>

<style><!--
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Tahoma;}

--></style>
<div dir="ltr">
[added subject]<br><br><div>

<style><!--
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Tahoma;}

--></style>
<div dir="ltr">
I strongly suggest that Target.Int be extended from 8 bytes to 9.<br><br>The reason is thus:<br><br><br>I was trying to mix TWord and TInt in M3C.m3.<br>It become tedious and error prone.<br><br><br>If Target.Int were extended to 9 bytes internally,<br>then it would have a range exceeding a signed 64bit integer<br>and a full range unsigned 64bit integer, and the need<br>for TWord would, I believe, go away.<br><br><br>The result would be *slightly* *slightly* *slightly*<br>less efficient, but more convenient.<br><br>I have already applied this change locally and built with it.<br>It was very simple.<br>I did have to visit the initializations of this mostly-opaque type, i.e. in Target.m3 and TInt.i3.<br><br><br>Furthermore, I weakly suggest that Target.Int<br>internally be changed to separately store the sign<br>and the magnitude. This would be a hidden implementation detail<br>and I believe it would simplify the implementation.<br>It would *slightly* deoptimize the representation size,<br>but the code, I think, would be smaller and simpler.<br>This would not affect the public interface.<br><br><br>I came to this suggestion when someone recently asked me how<br>to implement this sort of thing. I realize it is slightly easier<br>to store the sign and magnitude separately.<br><br><br><br> - Jay<br>                                        </div></div>                                        </div></div>                                        </div></body>
</html>