[M3devel] Enumeration or subrange value out of range

Jay K jay.krell at cornell.edu
Mon Nov 29 21:22:17 CET 2010


Signed int32 probably works for you, for storage.
 (Cstdint.int32_t or such).
For the operations, well, Word will do most of what you want.
Just be sure to and with 16_FFFFFFFF before each assignment?

We could flesh out /dev2/cm3/m3-libs/m3core/src/types
to contain the Word operations.
HOWEVER we'd want/need to provide version with exceptions or silence for overflow.

 - Jay


> Date: Mon, 29 Nov 2010 14:24:22 -0500
> From: hendrik at topoi.pooq.com
> To: m3devel at elegosoft.com
> Subject: Re: [M3devel] Enumeration or subrange value out of range
> 
> On Mon, Nov 29, 2010 at 11:14:56AM -0600, Ken Durocher wrote:
> > I am trying to write the Tiny Encryption Algorithm (TEA) in Modula-3, but I
> > ran into a problem.  The code compiles fine, but I get a runtime error. I'm
> > running 5.8.6 RELEASE on AMD64.
> > 
> > P.S. Is there already an unsigned int32 type?  Is there a better way to
> > create one?
> 
> There's a signed int32, and an unsigned int31, which is designed to fit 
> into a signed 32.  The closes you can come to unsigned int32 is probably 
> WORD.  Look up Word.T.
> 
> Unless you're using a 64-bit machine, in which case you get int64 and 
> unsigned int63 for free, I suppose.
> 
> -- hendrik
> 
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20101129/a0528f60/attachment-0002.html>


More information about the M3devel mailing list