Skip to content

Commit

Permalink
Fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
astei committed Sep 2, 2024
1 parent f86eb9a commit 2784ef5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,10 @@ public enum ProtocolUtils {
private static final int[] VAR_INT_LENGTHS = new int[65];

static {
for (int i = 0; i <= 64; ++i) {
VAR_INT_LENGTHS[i] = (63 - i) / 7;
for (int i = 0; i <= 32; ++i) {
VAR_INT_LENGTHS[i] = (int) Math.ceil((31d - (i - 1)) / 7d);
}
VAR_INT_LENGTHS[32] = 1; // Special case for the number 0.
}

private static DecoderException badVarint() {
Expand All @@ -139,8 +140,8 @@ public static int readVarInt(ByteBuf buf) {
}

// we can read at least one byte, and this should be a common case
int k = buf.readUnsignedByte();
if (k < 0x80) {
int k = buf.readByte();
if ((k & 0x80) != 128) {
return k;
}

Expand Down

This file was deleted.

0 comments on commit 2784ef5

Please sign in to comment.