git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166493
91177308-0d34-0410-b5e6-
96231b3b80d8
NumBuckets = getNumBuckets();
}
if (NumBuckets-(NewNumEntries+getNumTombstones()) <= NumBuckets/8) {
NumBuckets = getNumBuckets();
}
if (NumBuckets-(NewNumEntries+getNumTombstones()) <= NumBuckets/8) {
- this->grow(NumBuckets);
+ this->grow(NumBuckets * 2);
LookupBucketFor(Key, TheBucket);
}
assert(TheBucket);
LookupBucketFor(Key, TheBucket);
}
assert(TheBucket);
unsigned OldNumBuckets = NumBuckets;
BucketT *OldBuckets = Buckets;
unsigned OldNumBuckets = NumBuckets;
BucketT *OldBuckets = Buckets;
- allocateBuckets(std::max<unsigned>(64, NextPowerOf2(AtLeast)));
+ AtLeast = isPowerOf2_32(AtLeast) ? AtLeast : NextPowerOf2(AtLeast);
+ allocateBuckets(std::max<unsigned>(64, AtLeast));
assert(Buckets);
if (!OldBuckets) {
this->BaseT::initEmpty();
assert(Buckets);
if (!OldBuckets) {
this->BaseT::initEmpty();
}
void grow(unsigned AtLeast) {
}
void grow(unsigned AtLeast) {
- if (AtLeast >= InlineBuckets)
- AtLeast = std::max<unsigned>(64, NextPowerOf2(AtLeast));
+ if (AtLeast >= InlineBuckets) {
+ AtLeast = isPowerOf2_32(AtLeast) ? AtLeast : NextPowerOf2(AtLeast);
+ AtLeast = std::max<unsigned>(64, AtLeast);
+ }
if (Small) {
if (AtLeast < InlineBuckets)
if (Small) {
if (AtLeast < InlineBuckets)