From: "(see below)" <yaldnif.w@blueyonder.co.uk>
Subject: Re: Bit operations in Ada (endianness)
Date: Mon, 02 Jun 2008 15:01:19 +0100
Date: 2008-06-02T15:01:19+01:00 [thread overview]
Message-ID: <C469BBBF.EAE06%yaldnif.w@blueyonder.co.uk> (raw)
In-Reply-To: g20sg4$nkb$1@aioe.org
On 02/06/2008 14:27, in article g20sg4$nkb$1@aioe.org, "Dennis Hoppe"
<dennis.hoppe@hoppinet.de> wrote:
> I also wonder, if I can query the operating system via Ada,
> which endianness it uses.
No need to talk to the OS.
Try something like this:
-- N.B. not tested as written!
not_little_endian : exception;
type i08 is mod 2**8;
type i64 is mod 2**64;
type i08_group is array (0..7) of i08;
for i08_group'Component_Size use 8;
for i08_group'Size use 64;
the_i64 : i64 := 0;
the_i08_group : i08_group;
for the_i08_group'Address use the_i64'Address;
pragma Import (Ada, the_i08_group);
--
the_i08_group(0) := 1;
if the_i64 /= 1 then
raise not_little_endian
end if;
--
Bill Findlay
<surname><forename> chez blueyonder.co.uk
next prev parent reply other threads:[~2008-06-02 14:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-23 21:19 Bit operations in Ada Dennis Hoppe
2008-05-23 22:08 ` Ludovic Brenta
2008-05-24 15:36 ` Simon Wright
2008-06-02 13:27 ` Bit operations in Ada (endianness) Dennis Hoppe
2008-06-02 14:01 ` (see below) [this message]
2008-06-02 18:22 ` Jeffrey R. Carter
2008-06-02 17:38 ` Ludovic Brenta
2008-05-23 22:38 ` Bit operations in Ada Robert A Duff
2008-05-24 0:27 ` Randy Brukardt
2008-05-24 9:40 ` Bit operations in Ada (Thank you) Dennis Hoppe
2008-05-23 23:25 ` Bit operations in Ada Jeffrey R. Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox