Remove duplicate code in PoolArena. (#10174)
Motivation: Remove duplicate code in PoolArena. Modification: Replace duplicate code with `tinyIdx` and `smallIdx`. Result: Clean code.
This commit is contained in:
parent
a4ad6d15cd
commit
81b435b129
@ -321,15 +321,10 @@ abstract class PoolArena<T> implements PoolArenaMetric {
|
|||||||
int tableIdx;
|
int tableIdx;
|
||||||
PoolSubpage<T>[] table;
|
PoolSubpage<T>[] table;
|
||||||
if (isTiny(elemSize)) { // < 512
|
if (isTiny(elemSize)) { // < 512
|
||||||
tableIdx = elemSize >>> 4;
|
tableIdx = tinyIdx(elemSize);
|
||||||
table = tinySubpagePools;
|
table = tinySubpagePools;
|
||||||
} else {
|
} else {
|
||||||
tableIdx = 0;
|
tableIdx = smallIdx(elemSize);
|
||||||
elemSize >>>= 10;
|
|
||||||
while (elemSize != 0) {
|
|
||||||
elemSize >>>= 1;
|
|
||||||
tableIdx ++;
|
|
||||||
}
|
|
||||||
table = smallSubpagePools;
|
table = smallSubpagePools;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user