comp.lang.ada
 help / color / mirror / Atom feed
From: mheaney@ni.net (Matthew Heaney)
Subject: Re: Boolean array representation question
Date: 1997/11/22
Date: 1997-11-22T00:00:00+00:00	[thread overview]
Message-ID: <mheaney-ya023680002211970030030001@news.ni.net> (raw)
In-Reply-To: 880170219.81snx@jvdsys.nextjk.stuyts.nl


In article <880170219.81snx@jvdsys.nextjk.stuyts.nl>,
jerry@jvdsys.nextjk.stuyts.nl (Jerry van Dijk) wrote:

>In article <EK033F.9ps@sd.aonix.com> lippiell@ma.aonix.com writes:
>
>>   pragma pack(Bit_Array); -- ADD THIS LINE
>
>Yes, I know.
>
>The point is for some reason I have Boolean'Size = 1 in my
>head and cannot find the Boolean'Size =8^HStorage_Unit, other
>implicitly in 3.5.3.

You've got it right; Boolean'Size is defined to be 1.  However, you're
really interested in the component size of the array object.  The only
requirement is that the size of the array component can't be less than the
size of the component type.

If your compiler optimizes for speed, it's going to use the most
time-efficient way to get the value of a component.  For a Boolean, it
makes the most sense to allocate some integral number of storage elements
for each component.  It could be 8, 16, 32, whatever.  The value 8 seems to
be the best compromise between time and space.

To pack the components in contiguous bits by default would mean that it
takes a lot longer to access each component (on an architecture in which
each bit isn't independently addressable).

--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
<mailto:matthew_heaney@acm.org>
(818) 985-1271




  reply	other threads:[~1997-11-22  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-11-20  0:00 Boolean array representation question Jerry van Dijk
1997-11-20  0:00 ` Matthew Heaney
1997-11-21  0:00 ` John P. Lippiello
1997-11-22  0:00   ` Jerry van Dijk
1997-11-22  0:00     ` Matthew Heaney [this message]
1997-11-22  0:00       ` Robert Dewar
1997-11-23  0:00       ` Geert Bosch
1997-11-24  0:00         ` Larry Kilgallen
1997-11-24  0:00           ` Robert Dewar
1997-11-22  0:00     ` Robert Dewar
replies disabled

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