mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-20 22:31:34 +01:00
Simplify writeVarIntHeader
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
21bac6fba4
commit
f023b1bc07
@ -42,12 +42,9 @@ public final class Utils {
|
||||
}
|
||||
|
||||
public static void writeVarIntHeader(@NotNull ByteBuffer buffer, int startIndex, int value) {
|
||||
final int indexCache = buffer.position();
|
||||
buffer.position(startIndex);
|
||||
buffer.put((byte) (value & 0x7F | 0x80));
|
||||
buffer.put((byte) ((value >>> 7) & 0x7F | 0x80));
|
||||
buffer.put((byte) (value >>> 14));
|
||||
buffer.position(indexCache);
|
||||
buffer.put(startIndex, (byte) (value & 0x7F | 0x80));
|
||||
buffer.put(startIndex + 1, (byte) ((value >>> 7) & 0x7F | 0x80));
|
||||
buffer.put(startIndex + 2, (byte) (value >>> 14));
|
||||
}
|
||||
|
||||
public static int writeEmptyVarIntHeader(@NotNull ByteBuffer buffer) {
|
||||
|
Loading…
Reference in New Issue
Block a user