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.8 required=5.0 tests=BAYES_00,INVALID_DATE 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 04:16:10 PST Newsgroups: comp.lang.ada Path: sparky!uunet!rational.com!rlk From: rlk@Rational.COM (Robert Kitzberger) Subject: Re: How does Alsys index bit-arrays on Intel ? Message-ID: <1993Mar23.023912.1083@rational.com> Sender: news@rational.com Organization: Rational X-Newsreader: TIN [version 1.1 PL8] References: <1993Mar22.191652.16458@mksol.dseg.ti.com> Distribution: inet Date: Tue, 23 Mar 1993 02:39:12 GMT Date: 1993-03-23T02:39:12+00:00 List-Id: john r strohm (strohm@mksol.dseg.ti.com) wrote: : In article <1993Mar19.193443.524@scf.loral.com> bashford@srs.loral.com (Dave Bashford) writes: : >Can anyone tell me definitively whether a packed array of bits is indexed : >with the least-significant index in the most- or least-significant bit of : >each byte on an Intel-targeted Alsys Ada compiler ? : > : This comes up often enough that it is worth saying. : : ANSI/MIL-STD-1815A "Reference Manual for the Ada Programming Language" : section 13.4 paragraph 5 contains the following sentence: : : "The ordering of bits in a storage unit is machine-dependent and may : extend to adjacent storage units." : : The same pargraph also contains the following sentence: : : "Whether a component is allowed to overlap a storage boundary, and : if so, how, is implementation-defined." : : In other words, different compilers for different target processors are : allowed to do things differently. Sure, but the question is still valid -- quoting the LRM doesn't make the problem go away. If I recall, the poster is attempting to transfer data between machines in a heterogenous environment. 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; As far as the larger problem of normalizing data representations between dissimiliar architectures, take a look at networking literature for more ideas (on Unix, "man xdr" for starters). .Bob. -- ---------------------------------------------------- Bob Kitzberger Internet: rlk@rational.com Rational CompuServe: 70743,1550 Grass Valley, CA