mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-04 12:51:09 -05:00
Fix readVarLong.
This commit is contained in:
parent
885d03759d
commit
1b5b2c37a0
2 changed files with 6 additions and 6 deletions
|
@ -77,17 +77,17 @@ public class ByteBufferNetInput implements NetInput {
|
|||
|
||||
@Override
|
||||
public long readVarLong() throws IOException {
|
||||
int value = 0;
|
||||
long value = 0;
|
||||
int size = 0;
|
||||
int b;
|
||||
while(((b = this.readByte()) & 0x80) == 0x80) {
|
||||
value |= (b & 0x7F) << (size++ * 7);
|
||||
value |= (long) (b & 0x7F) << (size++ * 7);
|
||||
if(size > 10) {
|
||||
throw new IOException("VarLong too long (length must be <= 10)");
|
||||
}
|
||||
}
|
||||
|
||||
return value | ((b & 0x7F) << (size * 7));
|
||||
return value | ((long) (b & 0x7F) << (size * 7));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -93,17 +93,17 @@ public class StreamNetInput implements NetInput {
|
|||
|
||||
@Override
|
||||
public long readVarLong() throws IOException {
|
||||
int value = 0;
|
||||
long value = 0;
|
||||
int size = 0;
|
||||
int b;
|
||||
while(((b = this.readByte()) & 0x80) == 0x80) {
|
||||
value |= (b & 0x7F) << (size++ * 7);
|
||||
value |= (long) (b & 0x7F) << (size++ * 7);
|
||||
if(size > 10) {
|
||||
throw new IOException("VarLong too long (length must be <= 10)");
|
||||
}
|
||||
}
|
||||
|
||||
return value | ((b & 0x7F) << (size * 7));
|
||||
return value | ((long) (b & 0x7F) << (size * 7));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue