comp.lang.ada
 help / color / mirror / Atom feed
From: "Warren W. Gay VE3WWG" <ve3wwg@home.com>
Subject: Re: 64bit access to an array of 8bit values
Date: Mon, 04 Mar 2002 18:00:44 GMT
Date: 2002-03-04T18:00:44+00:00	[thread overview]
Message-ID: <3C83B64C.702@home.com> (raw)
In-Reply-To: mailman.1015194302.22754.comp.lang.ada@ada.eu.org

David C. Hoos, Sr. wrote:

> How about something like this?
> 
...

>    function Value (Index : Ram_Range) return Interfaces.Unsigned_64
>    is
>       Result : Interfaces.Unsigned_64;
>       for Result'Address use Ram (Index)'Address;
>    begin
>       return Result;
>    end Value;

I don't think you'll find this particularly portable. Even if

the compiler allows it, on some UNIX (for example) platforms
you may get a SIGBUS error if the Index value is not on a word
boundary (some CPUs like SPARC and other big endian machines
seem to come to mind in this regard).

There is another nit-pick with regards to safety if you try
using Index values that would address the last 3 bytes of the
available "RAM", returning a 4-byte value.


-- 
Warren W. Gay VE3WWG
http://home.cogeco.ca/~ve3wwg




  parent reply	other threads:[~2002-03-04 18:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-03 14:58 64bit access to an array of 8bit values Dave Poirier
2002-03-03 15:38 ` Jim Rogers
2002-03-03 18:02 ` John R. Strohm
2002-03-03 16:39   ` Dave Poirier
2002-03-03 17:27   ` Jeffrey Creem
2002-03-05 20:49     ` John R. Strohm
2002-03-05 23:52       ` Jeffrey Creem
2002-03-06  7:30         ` John R. Strohm
2002-03-06 11:50           ` Jeffrey Creem
2002-03-07 20:03             ` John R. Strohm
2002-03-04 10:29   ` Robert Dewar
2002-03-04 13:02     ` Larry Kilgallen
2002-03-04 13:41       ` Dave Poirier
2002-03-03 22:24 ` David C. Hoos, Sr.
2002-03-03 22:51   ` Dave Poirier
2002-03-04  2:40     ` David C. Hoos, Sr.
2002-03-04  4:08     ` David Starner
2002-03-04 10:31   ` Robert Dewar
2002-03-04 18:00   ` Warren W. Gay VE3WWG [this message]
2002-03-04  3:15 ` Pat Rogers
2002-03-04  7:23 ` Jeffrey 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