mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Reuse IOTools.stopBitLength() in StopBitSizeMarshaller
This commit is contained in:
@@ -18,6 +18,8 @@ package net.openhft.chronicle.map.serialization;
|
||||
|
||||
import net.openhft.lang.io.Bytes;
|
||||
|
||||
import static net.openhft.lang.io.IOTools.stopBitLength;
|
||||
|
||||
public final class SizeMarshallers {
|
||||
|
||||
public static SizeMarshaller stopBit() {
|
||||
@@ -29,11 +31,7 @@ public final class SizeMarshallers {
|
||||
|
||||
@Override
|
||||
public int sizeEncodingSize(long size) {
|
||||
if (size <= 127)
|
||||
return 1;
|
||||
// numberOfLeadingZeros is cheap intrinsic on modern CPUs
|
||||
// integral division is not... but there is no choice
|
||||
return ((70 - Long.numberOfLeadingZeros(size)) / 7);
|
||||
return stopBitLength(size);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user