Cool bananas. Thanks for the helpfull replies.

I guess that if I had looked more closely at the SetSize method I should
have figured it out. :)  The array will be filled with about 60% true values
so it makes sense to store the whole lot.  But I have used the concept of
just recording where the true values are else where to good effect.

Cheers,
Nahum

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Wes Edwards
> Sent: Friday, December 15, 2000 14:32
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: TBits - array of bits
>
>
> Another thought ...
>
> Are the arrays large with only a few true values?  If so a sparse array
> approach may be better.  IE only allocate space to store a true
> value.  You
> will have to allocate space to tell you which values you have and map the
> real index to the storage index, but if the number of values to be stored
> are very small w.r.t. the overall size of the array you may end up with a
> saving.
>
> By the way, a black & white bitmap is a 2D array of boolean values.
>
> Wes Edwards
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> > Behalf Of Nahum Wild
> > Sent: Friday, 15 December 2000 13:06
> > To: Multiple recipients of list delphi
> > Subject: [DUG]: TBits - array of bits
> >
> >
> > I'm wanting to create a 2d array of bits where the less memory
> > used to store
> > the array the better.  A boolean array is out of the question
> as a boolean
> > uses up a byte.  So I looked in the D5 help and found the TBits
> class.  It
> > is accessed as a boolean but looking at its source code reveals that its
> > coded in assembler.  Which I can't read.  So my question is - does TBits
> > store everything at the bit level or at the byte level?
> >
> > Alternatively does anyone know of a different approach to doing
> this where
> > memory footprint it critical with access speed coming a close second?
> >
> >
> > Cheers,
> >
> > Nahum Wild
> > Game Designer
> > Realism Ltd
> >
> > ESDAO - The wargame of a thousand faces.
> > http://www.esdao.net
> >
> > Download the public beta version now!
> >
> > ------------------------------------------------------------------
> > ---------
> >     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> >                   Website: http://www.delphi.org.nz
> > To UnSub, send email to: [EMAIL PROTECTED]
> > with body of "unsubscribe delphi"
> >
>
> ------------------------------------------------------------------
> ---------
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
>
>

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to