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 GitHub
parent 17f205fab3
commit ff6d2e4949
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;
}