From: James Rogers <jimmaureenrogers@att.net>
Subject: Re: Any examples of Byte Ordering Functions
Date: Thu, 16 Oct 2003 01:01:16 GMT
Date: 2003-10-16T01:01:16+00:00 [thread overview]
Message-ID: <Xns9415C0871D6B0jimmaureenrogers@204.127.36.1> (raw)
In-Reply-To: 1066243458.911546@master.nyc.kbcfp.com
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1317 bytes --]
Hyman Rosen <hyrosen@mail.com> wrote in
news:1066243458.911546@master.nyc.kbcfp.com:
> Larry Kilgallen wrote:
>>>Do Byte ordering functions (htonl, htons, ntohl, ntohs) exist in Ada?
>> Your question seems to me to indicate you are trying to program in C
>> using an Ada compiler.
>
> So what's the Ada way of writing portable code that
> writes out and reads in 16-bit and 32-bit integers
> for an external data source that has a defined byte
> ordering?
>
To quote from the Ada Language Reference Manual section 13.5:
For every specific record subtype S, the following attribute is defined:
S�Bit_Order Denotes the bit ordering for the type of S. The value of this
attribute is of type System.Bit_Order. Bit_Order may be specified for
specific record types via an attribute_definition_clause; the expression of
such a clause shall be static.
A bit ordering is a method of interpreting the meaning of the storage place
attributes. High_Order_First (known in the vernacular as big endian) means
that the first bit of a storage element (bit 0) is the most significant bit
(interpreting the sequence of bits that represent a component as an
unsigned integer value). Low_Order_First (known in the vernacular as little
endian) means the opposite: the first bit is the least significant.
Jim Rogers
next prev parent reply other threads:[~2003-10-16 1:01 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-15 17:42 Any examples of Byte Ordering Functions Bill Sheehan
2003-10-15 18:55 ` Larry Kilgallen
2003-10-15 18:44 ` Hyman Rosen
2003-10-16 1:01 ` James Rogers [this message]
2003-10-16 13:32 ` Hyman Rosen
2003-10-16 14:59 ` Martin Dowie
2003-10-16 20:00 ` tmoran
2003-10-17 12:08 ` Martin Dowie
2003-10-19 15:22 ` chris
2003-10-19 17:25 ` (see below)
2003-10-19 13:45 ` chris
2003-10-19 16:53 ` Martin Dowie
2003-10-19 17:52 ` chris
2003-10-19 19:24 ` Martin Dowie
2003-10-19 20:47 ` Jeffrey Carter
2003-10-19 22:53 ` tmoran
2003-10-20 4:14 ` Jeffrey Carter
2003-10-23 20:36 ` Laurent Pautet
2003-10-23 21:37 ` Simon Wright
2003-10-24 4:37 ` Simon Wright
2003-10-26 15:05 ` Georg Bauhaus
2003-10-23 20:44 ` Laurent Pautet
2003-10-23 21:03 ` Laurent Pautet
2003-10-15 19:58 ` Frank J. Lhota
2003-10-16 16:28 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox