comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: What about big integers in Ada 2005?
Date: Sun, 02 Oct 2005 16:12:18 +0100
Date: 2005-10-02T16:12:18+01:00	[thread overview]
Message-ID: <m24q80eywd.fsf@grendel.local> (raw)
In-Reply-To: 1614932.bCcW5lLfee@linux1.krischik.com

Martin Krischik <krischik@users.sourceforge.net> writes:

> Brian May wrote:
>
>> Question (from writing a communications protocol with a high level
>> programming language that turned out to a an extremely poor
>> choice[1]):
>
> package Interfaces is
> pragma Pure (Interfaces);
>
>    type Integer_8  is range -2 **  7 .. 2 **  7 - 1;
>    for Integer_8'Size use  8;
>
>    type Integer_16 is range -2 ** 15 .. 2 ** 15 - 1;
>    for Integer_16'Size use 16;
>
>    type Integer_32 is range -2 ** 31 .. 2 ** 31 - 1;
>    for Integer_32'Size use 32;
>
>    type Integer_64 is range -2 ** 63 .. 2 ** 63 - 1;
>    for Integer_64'Size use 64;
>
>    type Unsigned_8  is mod 2 **  8;
>    for Unsigned_8'Size use  8;
>
>    type Unsigned_16 is mod 2 ** 16;
>    for Unsigned_16'Size use 16;
>
>    type Unsigned_32 is mod 2 ** 32;
>    for Unsigned_32'Size use 32;
>
>    type Unsigned_64 is mod 2 ** 64;
>    for Unsigned_64'Size use 64;

This is GNAT. On the other hand, RM95 says

package Interfaces is
   pragma Pure(Interfaces);

   type Integer_n is range -2**(n-1) .. 2**(n-1) - 1;  --2's complement

   type Unsigned_n is mod 2**n;

..

 An implementation shall provide the following declarations in the
 visible part of package Interfaces:

* Signed and modular integer types of n bits, if supported by the
  target architecture, for each n that is at least the size of a
  storage element and that is a factor of the word size. The names of
  these types are of the form Integer_n for the signed types, and
  Unsigned_n for the modular types;



  parent reply	other threads:[~2005-10-02 15:12 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-15 17:06 What about big integers in Ada 2005? jtg
2005-09-15 17:26 ` Pascal Obry
2005-09-15 17:30   ` Martin Dowie
2005-09-15 17:26 ` Martin Krischik
2005-09-15 19:37   ` Martin Dowie
2005-09-15 21:08     ` Larry Kilgallen
2005-09-15 20:33   ` jtg
2005-09-15 21:10     ` Larry Kilgallen
2005-09-18  0:46   ` adaworks
2005-09-30 17:41     ` Robert A Duff
2005-09-30 20:18       ` Jeffrey R. Carter
2005-10-02  0:27       ` adaworks
     [not found]         ` <imsuj1h8vevg4un71rmh0nc41pnee5ihjl@4ax.com>
2005-10-02 10:33           ` Martin Krischik
2005-10-02 16:20             ` adaworks
2005-10-04  5:24           ` adaworks
2005-10-04  7:22             ` tmoran
2005-10-04  8:25             ` Dmitry A. Kazakov
2005-10-04 11:57               ` Simon Clubley
2005-10-04 16:10                 ` Robert A Duff
2005-10-04 17:24                   ` Simon Clubley
2005-10-04 19:44                     ` Robert A Duff
2005-10-04 13:46               ` adaworks
2005-10-04 16:38                 ` Robert A Duff
2005-10-04 16:52                   ` Martin Dowie
2005-10-04 17:16                     ` Robert A Duff
2005-10-04 13:50               ` adaworks
2005-10-04 14:59                 ` Larry Kilgallen
2005-10-04 16:03                 ` Robert A Duff
2005-10-04 18:56                   ` adaworks
2005-10-10  5:36                     ` Dave Thompson
2005-10-14  0:31                       ` adaworks
2005-10-06 14:21             ` Adrian Hoe
2005-10-07  6:48               ` Martin Krischik
2005-10-02  0:48   ` Brian May
2005-10-02 10:28     ` Martin Krischik
2005-10-02 10:52       ` Brian May
2005-10-02 15:12       ` Simon Wright [this message]
2005-10-02 17:11         ` Martin Dowie
2005-09-16 14:33 ` gautier_niouzes
2005-09-17  3:43   ` Craig Carey <research@ijs.co.nz>
replies disabled

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