What have I missed?

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 8 15:43:37 PDT 2014


On 8/7/14, 12:40 PM, Era Scarecrow wrote:
>   As for being able to find x number of bits that are 0 or 1 in a row,
> that both sounds easy and hard at the same time (easy if you don't mind
> it being slow). In my rewrite there was a bulk template I created that
> was intended to do huge speedups with binary data (when the data was
> naturally aligned correctly and large enough to use the binary operators
> on normal types). Some of the unittests and example code also used them
> in a read-only fashion that could be specialized for finding a certain
> type of pattern...

A thought: if whatever work on bit arrays you do isn't fast, it's 
probably not worth doing; people who opt for that kind of packing are 
most often performance motivated.

Alignment is often not an issue - you handle the setup/teardown 
misalignments separately and to the bulk 64 bits at a time.

Instead of a full-blown abstraction you may want to instead opt for 
defining some simple primitives using ulong[] that are accessible to 
people having data embedded in odd places. The bit operations in 
std.allocator would be good and practical.


Andrei



More information about the Digitalmars-d mailing list