mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 744052 - Restructure HashTable::checkOverflow for easier reading; r=luke
When I added this function, I just copied the existing logical structure. It makes more sense here to check overflowed and return early, since we can do this now.
This commit is contained in:
parent
5ec5cf5d06
commit
dfd9f312e5
@ -619,21 +619,20 @@ class HashTable : private AllocPolicy
|
||||
|
||||
bool checkOverloaded()
|
||||
{
|
||||
if (overloaded()) {
|
||||
/* Compress if a quarter or more of all entries are removed. */
|
||||
int deltaLog2;
|
||||
if (removedCount >= (capacity() >> 2)) {
|
||||
METER(stats.compresses++);
|
||||
deltaLog2 = 0;
|
||||
} else {
|
||||
METER(stats.grows++);
|
||||
deltaLog2 = 1;
|
||||
}
|
||||
if (!overloaded())
|
||||
return false;
|
||||
|
||||
return changeTableSize(deltaLog2);
|
||||
/* Compress if a quarter or more of all entries are removed. */
|
||||
int deltaLog2;
|
||||
if (removedCount >= (capacity() >> 2)) {
|
||||
METER(stats.compresses++);
|
||||
deltaLog2 = 0;
|
||||
} else {
|
||||
METER(stats.grows++);
|
||||
deltaLog2 = 1;
|
||||
}
|
||||
|
||||
return false;
|
||||
return changeTableSize(deltaLog2);
|
||||
}
|
||||
|
||||
void remove(Entry &e)
|
||||
|
Loading…
Reference in New Issue
Block a user