Ada Resource Association
News and resources for the Ada programming language
Ada Reference ManualLegal Information
Contents   Index   References   Search   Previous   Next 

13.5.3 Bit Ordering

The Bit_Order attribute specifies the interpretation of the storage place attributes. 

Static Semantics

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: 
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: 
13  Bit_Order clauses make it possible to write record_representation_clauses that can be ported between machines having different bit ordering. They do not guarantee transparent exchange of data between such machines.

Contents   Index   References   Search   Previous   Next 
Ada-Europe Sponsored by Ada-Europe