comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@attbi.com>
Subject: Re: Extended modal types
Date: Mon, 27 May 2002 04:57:18 GMT
Date: 2002-05-27T04:57:18+00:00	[thread overview]
Message-ID: <3CF1BE0C.8020704@attbi.com> (raw)
In-Reply-To: 874rgwt6jf.fsf@deneb.enyo.de

Florian Weimer wrote:


> (IMHO, modular types whose modular type whose modulus is not a power
> of two should have been avoided altogether.)


Shows your hardware bias. ;-)  There are two very useful applications of 
modular types in Ada.  One where the modulus is an integral power of two 
maps nicely to a lot of hardware device interfaces, etc.  The other is 
in the area of cryptography and hashing, where the modulus tends to be a 
prime, or the product of two primes.  On a lot of hardware (X * Y) mod 
some large prime is a very useful operation, and maps neatly to a 32-bit 
by 32-bit multiply with a 64 (actually 63) bit result, and a divide by a 
32 bit integer keeping the remainder.  Most programming languages have 
no easy way of getting to those hardware instructions.

Are there operations on modular types which are pretty useless for 
non-power of two modulii, and there are operations that are only of 
interest for such modulii.  Ada supports both, and there is a large 
enough set of operations that make sense for both that the two sets of 
types were unified.  (Except in the limits in package System.)






  parent reply	other threads:[~2002-05-27  4:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-24  8:53 Extended modal types Anatoly Chernyshev
2002-05-24 11:38 ` Marc A. Criley
2002-05-25 15:57 ` Robert Dewar
2002-05-25 18:06   ` Frank J. Lhota
2002-05-25 18:40     ` Florian Weimer
2002-05-25 21:56       ` David C. Hoos, Sr.
2002-05-27  4:57       ` Robert I. Eachus [this message]
2002-05-27  5:52         ` Florian Weimer
2002-05-27 23:47           ` Robert I. Eachus
2002-05-29  1:16             ` Robert Dewar
2002-05-29  2:31   ` Robert A Duff
2002-05-29  9:19     ` Dmitry A. Kazakov
2002-05-29  9:54     ` Robert Dewar
2002-05-29 15:20 ` Anatoly Chernyshev
2002-05-29 23:36   ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox