mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 22:21:09 +03:00
fix appenderNewCapacity for curLen == 0, start with minimum of 8.
This commit is contained in:
parent
9741b28af2
commit
cc548fe9cb
1 changed files with 2 additions and 0 deletions
|
@ -2454,6 +2454,8 @@ struct Appender(A : T[], T)
|
|||
//ret sugLen: A suggested growth.
|
||||
private size_t appenderNewCapacity(size_t TSizeOf)(size_t curLen, size_t reqLen) @safe pure nothrow
|
||||
{
|
||||
if(curLen == 0)
|
||||
return max(reqLen,8);
|
||||
ulong mult = 100 + (1000UL) / (bsr(curLen * TSizeOf) + 1);
|
||||
// limit to doubling the length, we don't want to grow too much
|
||||
if(mult > 200)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue