BitArray implementation issue

safety0ff via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 22 20:08:24 PDT 2014


On Wednesday, 23 July 2014 at 00:59:38 UTC, H. S. Teoh via 
Digitalmars-d wrote:
>
> I think it's best to keep a bit count of the number of valid 
> bits at the
> end of the array, in addition to the number of words in the 
> underlying
> array. You might also want to consider keeping a bit count of 
> the number
> of valid bits at the *start* of the array, so that it's 
> possible to
> bit-level slicing in a transparent way.
>

Sorry, being too eager to reply.
We would need to use a secondary pointer to the count to avoid 
breaking code that uses the void init(void[], size_t) function 
which allows arbitrary bit twiddling of the passed in array.


More information about the Digitalmars-d mailing list