New adapter: std.allocator.quantizer
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Mon May 11 11:45:10 PDT 2015
On 5/11/15 11:06 AM, Timon Gehr wrote:
> - If the rounding function is not piecewise constant with one fixed
> point per piece, it can happen that 'allocated >= needed' but 'allocated
> < goodAllocSize(needed)'. Then, the allocated size will be inconsistent
> with goodAllocSize. (This is why I recommended to require the rounding
> function to have this property, which is stronger than monotonicity.)
Got it. That's a rather subtle requirement, so I changed the code to
keep things simple for the user:
https://github.com/andralex/phobos/commit/9307b9f8969b7bfd0906e0441a13cbbded7f8418
> - If b.ptr is null, then line 113 is bad in case goodAllocSize(0) > 0.
That should be fixed in the same commit; I just handle expansion of null
blocks up front in expand().
Thanks,
Andrei
More information about the Digitalmars-d
mailing list