comp.lang.ada
 help / color / mirror / Atom feed
From: Jim Rogers <jimmaureenrogers@worldnet.att.net>
Subject: Re: Bitordering? was Re: Bitmanipulation in Ada
Date: Sat, 21 Aug 2004 14:00:33 GMT
Date: 2004-08-21T14:00:33+00:00	[thread overview]
Message-ID: <Xns954C517EF737jimmaureenrogers@127.0.0.1> (raw)
In-Reply-To: opsc2yf8zvp4pfvb@bram-2

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1901 bytes --]

"Nick Roberts" <nick.roberts@acm.org> wrote in 
news:opsc2yf8zvp4pfvb@bram-2:

> On Fri, 20 Aug 2004 22:57:40 +0200, Alfred Hilscher  
> <SPAM@alfred-hilscher.de> wrote:
> 
>> When I declare an boolean array with eight elements 1..8 (e.g. to
>> address a hardware port with eight status bits), how are they
>> ordered is X(1) the msb or the lsb of the byte?
> 
> It is undefined.

It is undefined in an array. It can be defined in a record.

The Ada LRM, section 13.5.3 deals with bit ordering issues.
To quoute:

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. 

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. 

If Word_Size = Storage_Unit, the default bit ordering is implementation 
defined. If Word_Size > Storage_Unit, the default bit ordering is the 
same as the ordering of storage elements in a word, when interpreted as 
an integer. 

The storage place attributes of a component of a type are interpreted 
according to the bit ordering of the type. 

Implementation Advice 

The recommended level of support for the nondefault bit ordering is: 

If Word_Size = Storage_Unit, then the implementation should support the 
nondefault bit ordering in addition to the default bit ordering.

Jim Rogers




  reply	other threads:[~2004-08-21 14:00 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-18 20:37 Bitmanipulation in Ada Bernd Specht
2004-08-18 20:51 ` Ludovic Brenta
2004-08-18 21:10   ` Bernd Specht
2004-08-18 21:16     ` Ludovic Brenta
2004-08-18 21:18     ` Ed Falis
2004-08-19 17:30       ` Bernd Specht
2004-08-19 17:44         ` Ed Falis
2004-08-19  0:53     ` Jeffrey Carter
2004-08-19 17:44       ` Bernd Specht
2004-08-19 18:09         ` Martin Dowie
2004-08-19 18:28           ` Bernd Specht
2004-08-19 19:31             ` Martin Dowie
2004-08-19 20:29             ` Martin Dowie
2004-08-20 21:31               ` Bernd Specht
2004-08-19 19:17         ` Jeffrey Carter
2004-08-19 19:57           ` Björn Persson
2004-08-20  0:52             ` Jeffrey Carter
2004-08-19 21:24         ` Francois G. Dorais
2004-08-20  8:55           ` Pascal Obry
2004-08-20  7:26         ` Jean-Pierre Rosen
2004-08-20 21:20           ` Bernd Specht
2004-08-20 21:39             ` Ed Falis
2004-08-18 21:14 ` (see below)
2004-08-18 21:56   ` Martin Dowie
2004-08-19 15:25     ` (see below)
2004-08-19 15:50       ` Martin Dowie
2004-08-18 21:53 ` Martin Dowie
2004-08-18 22:59   ` Björn Persson
2004-08-19  8:08   ` Egil H. H�vik
2004-08-19 17:46   ` Bernd Specht
2004-08-20 20:57 ` Bitordering? was " Alfred Hilscher
2004-08-21 11:34   ` Nick Roberts
2004-08-21 14:00     ` Jim Rogers [this message]
2004-08-21 16:54       ` Simon Wright
2004-08-21 16:55     ` Georg Bauhaus
2004-08-23 18:36       ` Alfred Hilscher
2004-08-23 18:47     ` Alfred Hilscher
2004-08-23 22:39       ` Nick Roberts
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox