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=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2d886a1f8c2fd7b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1993-03-23 08:01:16 PST Newsgroups: comp.lang.ada Path: sparky!uunet!newsgate.watson.ibm.com!yktnews.watson.ibm.com!ncohen From: ncohen@watson.ibm.com (Norman H. Cohen) Subject: Re: How does Alsys index bit-arrays on Intel ? Sender: news@watson.ibm.com (NNTP News Poster) Message-ID: Date: Tue, 23 Mar 1993 15:29:18 GMT Distribution: inet Reply-To: ncohen@watson.ibm.com Disclaimer: This posting represents the poster's views, not necessarily those of IBM. References: <1993Mar22.191652.16458@mksol.dseg.ti.com> <1993Mar23.023912.1083@rational.com> Nntp-Posting-Host: prener.watson.ibm.com Organization: IBM T.J. Watson Research Center Date: 1993-03-23T15:29:18+00:00 List-Id: In article <1993Mar23.023912.1083@rational.com>, rlk@Rational.COM (Robert Kitzberger) writes: |> In order to determine the ordering empirically (the only way I'd trust ;-), |> I'd write a test case, and watch what happens on a logic |> analyzer. If no logic analyzer exists, then write some assembly code |> that accepts a bit number and an object, and tests whether that bit |> is a zero or a one (this way you can explicitly control the bit ordering). |> Then, create a dummy object and display it's contents as reported by your |> assembly routine: |> |> object := #1234_5678#; |> for I in bits loop |> if assy_bit_is_on( object, I ) then <---implement in assembly |> put("1"); |> else |> put("0); |> end if; |> end loop; Logic analyzer? Assembly routine? A straightforward test can be written entirely in Ada: with Text_IO; use Text_IO; with Unchecked_Conversion; procedure Test_Bit_Numbering is type Bit is (Zero, One); for Bit use (Zero => 0, One => 1); for Bit'Size use 1; type Bit_Vector is array (Natural range <>) of Bit; pragma Pack(Bit_Vector); type Word_Type is record Bit_Zero : Bit; Other_Bits : Bit_Vector(0 .. 30); end record; for Word_Type use record Bit_Zero at 0 range 0 .. 0; Other_Bits at 0 range 1 .. Integer'Size-1; end record; for Word_Type'Size use Integer'Size; function Word_To_Integer is new Unchecked_Conversion (Word_Type, Integer); Word : Word_Type; begin Word.Bit_Zero := One; Word.Other_Bits := (0 .. 30 => Zero); if Word_To_Integer(Word) = 1 then Put_Line ("Bit zero is the low-order bit."); else Put_Line ("Bit zero is the high-order bit."); end if; end Test_Bit_Numbering; I believe the original question was about numbering the components used in Boolean arrays rather than about numbering the bits in record-representation clauses. It should be obvious how to modify this program to answer the array-component question too. -- Norman H. Cohen ncohen@watson.ibm.com