comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: 64-bit integers in Ada
Date: Mon, 29 Jul 2002 20:15:45 GMT
Date: 2002-07-29T20:15:45+00:00	[thread overview]
Message-ID: <wccy9buqoi6.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: Xns925A758E8FB6Avictorgiddingsoiscom@192.84.85.25

Victor Giddings <victor.giddings@ois.com> writes:

> David Rasmussen <david.rasmussen@gmx.spam.egg.sausage.and.spam.net> wrote 
> in news:3CE3978F.6070704@gmx.spam.egg.sausage.and.spam.net:
> 
> > I understand that I can easily use an integer in Ada that has exactly 64 
> > bits. But are there any guarantees that such a type would be mapped to 
> > native integers on 64-bit machines or to a reasonable double 32-bit 
> > implementation on 32-bit machines?

In the language standard, there is no "guarantee" of anything related to
efficiency.  I think that's true of pretty much all languages, and I
don't see how one could do better.

>... At least, are compilers ok at this in 
> > real life?

Yes.  Compiler writers don't deliberately go out of their way to harm
efficiency.

Note that the RM does not require support for 64-bit integers
(unfortunately, IMHO), and there are compilers that do not support
64-bit integers.  But if the compiler *does* support 64-bit integers,
I see no reason to suspect that it wouldn't do so in the obviously
efficient way (native 64-bit ints on a 64-bit machine, or a pair of
32-bit ints on a 32-bit machine).

> > /David
> 
> Try using (or deriving from) Interfaces.Integer_64 or Integer.Unsigned_64. 
> Admittedly, this requires 2 steps on the part of the compiler developer. 1) 
> actually support the 64-bit integer type. 2) to put it in Interfaces (as 
> required by B.2(7)). However, we rely on this in our CORBA product 
> implementation and have been making sure that the compiler vendors are 
> adding these types when they are supported. 

I don't see the point of this advice.  If you say "type T is range
-2**63..2**63-1;", I don't see any reason why T would be more or less
efficient than Interfaces.Integer_64.  In fact, I would think they would
have identical representation, and arithmetic ops would use identical
machine code.

> As of now, I know of only one compiler that supports 64-bit integers and 
> doesn't define Interface.Integer_64. That is to be remedied very soon.

- Bob



  reply	other threads:[~2002-07-29 20:15 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-16 11:27 64-bit integers in Ada David Rasmussen
2002-05-17  2:28 ` Robert Dewar
2002-05-17 13:56 ` Mark Johnson
2002-07-29 15:33 ` Victor Giddings
2002-07-29 20:15   ` Robert A Duff [this message]
2002-07-30 18:35     ` Richard Riehle
2002-07-30 20:20       ` Robert A Duff
2002-07-31  0:13       ` Robert Dewar
2002-07-31  4:17         ` Keith Thompson
2002-07-31  8:41           ` Larry Kilgallen
2002-07-31 13:20           ` Robert A Duff
2002-07-31 13:42             ` Marin David Condic
2002-08-01  7:54               ` Lutz Donnerhacke
2002-08-01 13:07                 ` Marin David Condic
2002-08-02  7:31                   ` Lutz Donnerhacke
2002-08-02 13:21                     ` Marin David Condic
2002-08-03 12:24                       ` Robert Dewar
2002-08-03 18:59                         ` Richard Riehle
2002-08-04  6:12                           ` Chad R. Meiners
2002-08-04 14:07                           ` Robert Dewar
2002-08-05  2:28                             ` Richard Riehle
2002-08-11 15:32                               ` Simon Wright
2002-08-13 21:14                             ` Randy Brukardt
2002-08-04 18:00                           ` Larry Kilgallen
     [not found]                           ` <5ee5b646.0208040607.ebb6909@posting.googOrganization: LJK Software <PG2KS5+doDWm@eisner.encompasserve.org>
2002-08-05  1:44                             ` Robert Dewar
2002-08-05  1:48                             ` Robert Dewar
2002-08-05 11:40                               ` Marc A. Criley
2002-08-05 14:40                                 ` Pat Rogers
2002-08-05  2:34                             ` Richard Riehle
2002-08-11 21:56                           ` Robert A Duff
2002-08-13 21:09                         ` Randy Brukardt
2002-08-18  1:01                           ` AG
2002-08-20  0:15                             ` Robert Dewar
2002-08-02  8:37                   ` Fraser Wilson
2002-08-02 12:54                   ` Frank J. Lhota
2002-08-01 11:57               ` Larry Kilgallen
2002-08-01 17:53               ` Ben Brosgol
2002-08-01 20:32               ` Keith Thompson
2002-07-31 21:50             ` Keith Thompson
2002-07-31 21:59               ` Robert A Duff
2002-07-30  4:29   ` 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