comp.lang.ada
 help / color / mirror / Atom feed
From: Brian May <bam@snoopy.apana.org.au>
Subject: Re: What about big integers in Ada 2005?
Date: Sun, 02 Oct 2005 10:48:40 +1000
Date: 2005-10-02T10:48:40+10:00	[thread overview]
Message-ID: <sa41x34hhg7.fsf@snoopy.microcomaustralia.com.au> (raw)
In-Reply-To: 1581461.uQ1jN63t33@linux1.krischik.com

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

    Martin> You are mistaken here. i.E GNAT supports 64 integers for
    Martin> 32 bit CPUs. It's all up to the particular compiler. In
    Martin> theory you could create an Ada compiler which supports
    Martin> intergers up to the memory limit - it would still conform
    Martin> to the standart.

Question (from writing a communications protocol with a high level
programming language that turned out to a an extremely poor
choice[1]):

Does GNAT support both "unsigned" and "signed" 64 bit numbers on 32
bit CPUs?

The reason I ask is because the protocol specs say some numbers might
be 64 bit, and sometimes they are signed, and other times that might
be unsigned. I am just curious if how well Ada could cope with this.

Notes:

[1] PHP. As far as I can tell it only supports signed 32 bit numbers
on 32 bit platforms[1].

[2] Fortunately, 32 bit numbers are probably OK for my client. This is
kind of ugly though, as I have to store the numbers in a mysql
database (signed/unsigned up to 64 bit[3]). My current approach is to
turn it into a positive number and store it in an unsigned 64 bit
field, with another field to indicate that the number is
negative. Unfortunately, the negative number 8000 0000 (hex) can't be
represented as a positive number in a signed 32 bit integer :-(.  So I
transform the number into 7FFF FFFF (hex) instead. This results in it
being out by one.

[3] Yes, even though the current code doesn't support 64bit, I have
designed the database to support it properly.
-- 
Brian May <bam@snoopy.apana.org.au>



  parent reply	other threads:[~2005-10-02  0:48 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 [this message]
2005-10-02 10:28     ` Martin Krischik
2005-10-02 10:52       ` Brian May
2005-10-02 15:12       ` Simon Wright
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