Reuse IOTools.stopBitLength() in StopBitSizeMarshaller

This commit is contained in:
leventov
2014-10-16 12:23:03 +04:00
parent 331bdf8328
commit 860bebe7f2
@@ -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