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:
时无两丶 2020-04-15 15:29:23 +08:00 committed by Norman Maurer
parent a4ad6d15cd
commit 81b435b129

View File

@ -321,15 +321,10 @@ abstract class PoolArena<T> implements PoolArenaMetric {
int tableIdx;
PoolSubpage<T>[] table;
if (isTiny(elemSize)) { // < 512
tableIdx = elemSize >>> 4;
tableIdx = tinyIdx(elemSize);
table = tinySubpagePools;
} else {
tableIdx = 0;
elemSize >>>= 10;
while (elemSize != 0) {
elemSize >>>= 1;
tableIdx ++;
}
tableIdx = smallIdx(elemSize);
table = smallSubpagePools;
}