std.compress

Peter Alexander peter.alexander.au at gmail.com
Tue Jun 4 04:30:39 PDT 2013


On Tuesday, 4 June 2013 at 11:18:45 UTC, bearophile wrote:
> If you are interested in adding a CircularBuffer to Phobos, 
> then I'd like both that fixed sized one and a growing one like 
> this:
> http://rosettacode.org/wiki/Queue/Usage#Faster_Version

Nitpick;

head = (head + 1) & ((cast(size_t)1 << power2) - 1);

can be

head = (head + 1) & (A.length - 1);

No? power2 seems superfluous. Also, left/right shifts by variable 
amount are very slow on some processors

Anyway, we'll really need allocators before we can add more 
allocating containers. Andrei? :-)


More information about the Digitalmars-d mailing list