comp.lang.ada
 help / color / mirror / Atom feed
From: rlk@Rational.COM (Robert Kitzberger)
Subject: Re: How does Alsys index bit-arrays on Intel ?
Date: Tue, 23 Mar 1993 02:39:12 GMT
Date: 1993-03-23T02:39:12+00:00	[thread overview]
Message-ID: <1993Mar23.023912.1083@rational.com> (raw)
In-Reply-To: 1993Mar22.191652.16458@mksol.dseg.ti.com

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



  reply	other threads:[~1993-03-23  2:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-03-19 19:34 How does Alsys index bit-arrays on Intel ? Dave Bashford
1993-03-22 19:16 ` john r strohm
1993-03-23  2:39   ` Robert Kitzberger [this message]
1993-03-23 15:29     ` Norman H. Cohen
1993-03-23 20:27       ` john r strohm
1993-03-25 22:09         ` Dave Bashford
replies disabled

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