mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-05 12:31:33 +00:00
Improve DenseMap checks for power of 2 growth. Thanks for the tip Jakob
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166609 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b52fb87617
commit
99112c6b19
@ -600,8 +600,7 @@ public:
|
||||
unsigned OldNumBuckets = NumBuckets;
|
||||
BucketT *OldBuckets = Buckets;
|
||||
|
||||
AtLeast = isPowerOf2_32(AtLeast) ? AtLeast : NextPowerOf2(AtLeast);
|
||||
allocateBuckets(std::max<unsigned>(64, AtLeast));
|
||||
allocateBuckets(std::max<unsigned>(64, NextPowerOf2(AtLeast-1)));
|
||||
assert(Buckets);
|
||||
if (!OldBuckets) {
|
||||
this->BaseT::initEmpty();
|
||||
@ -827,10 +826,8 @@ public:
|
||||
}
|
||||
|
||||
void grow(unsigned AtLeast) {
|
||||
if (AtLeast >= InlineBuckets) {
|
||||
AtLeast = isPowerOf2_32(AtLeast) ? AtLeast : NextPowerOf2(AtLeast);
|
||||
AtLeast = std::max<unsigned>(64, AtLeast);
|
||||
}
|
||||
if (AtLeast >= InlineBuckets)
|
||||
AtLeast = std::max<unsigned>(64, NextPowerOf2(AtLeast-1));
|
||||
|
||||
if (Small) {
|
||||
if (AtLeast < InlineBuckets)
|
||||
|
Loading…
Reference in New Issue
Block a user