[M3devel] suggested Target.Int change

Jay K jay.krell at cornell.edu
Thu Dec 13 09:32:27 CET 2012


[added subject]





I strongly suggest that Target.Int be extended from 8 bytes to 9.

The reason is thus:


I was trying to mix TWord and TInt in M3C.m3.
It become tedious and error prone.


If Target.Int were extended to 9 bytes internally,
then it would have a range exceeding a signed 64bit integer
and a full range unsigned 64bit integer, and the need
for TWord would, I believe, go away.


The result would be *slightly* *slightly* *slightly*
less efficient, but more convenient.

I have already applied this change locally and built with it.
It was very simple.
I did have to visit the initializations of this mostly-opaque type, i.e. in Target.m3 and TInt.i3.


Furthermore, I weakly suggest that Target.Int
internally be changed to separately store the sign
and the magnitude. This would be a hidden implementation detail
and I believe it would simplify the implementation.
It would *slightly* deoptimize the representation size,
but the code, I think, would be smaller and simpler.
This would not affect the public interface.


I came to this suggestion when someone recently asked me how
to implement this sort of thing. I realize it is slightly easier
to store the sign and magnitude separately.



 - Jay
 		 	   		   		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20121213/68b46bf9/attachment-0002.html>


More information about the M3devel mailing list