use more efficient way to determine needed bytes for variable byte
encoding I experimented with a few branch-free variants, but they were slower than just using ternary operators and readable code.
This commit is contained in:
@@ -81,7 +81,7 @@ public class VariableByteEncoderTest {
|
||||
Assertions.assertEquals(originalValues, decodedValues);
|
||||
}
|
||||
|
||||
public static Stream<Arguments> providerNededBytes() {
|
||||
public static Stream<Arguments> providerNeededBytes() {
|
||||
return Stream.of( //
|
||||
Arguments.of(0, 1), //
|
||||
Arguments.of(-10, 1), //
|
||||
@@ -98,7 +98,7 @@ public class VariableByteEncoderTest {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("providerNededBytes")
|
||||
@MethodSource("providerNeededBytes")
|
||||
public void testNeededBytes(final long value, final int expectedNeededBytes) {
|
||||
|
||||
final int neededBytes = VariableByteEncoder.neededBytes(value);
|
||||
|
||||
Reference in New Issue
Block a user