From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9dec3ff1604723d9 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!news.glorb.com!wn11feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Bitordering? was Re: Bitmanipulation in Ada From: Jim Rogers References: <412665C4.E52A7590@alfred-hilscher.de> Organization: Your Company Message-ID: User-Agent: Xnews/5.04.25 Date: Sat, 21 Aug 2004 14:00:33 GMT NNTP-Posting-Host: 12.73.184.124 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1093096833 12.73.184.124 (Sat, 21 Aug 2004 14:00:33 GMT) NNTP-Posting-Date: Sat, 21 Aug 2004 14:00:33 GMT Xref: g2news1.google.com comp.lang.ada:2911 Date: 2004-08-21T14:00:33+00:00 List-Id: "Nick Roberts" wrote in news:opsc2yf8zvp4pfvb@bram-2: > On Fri, 20 Aug 2004 22:57:40 +0200, Alfred Hilscher > 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