From 6157e8bb4086dc81e6f6f8df1ccbdf187a54a44c Mon Sep 17 00:00:00 2001 From: Egor Koleda Date: Sat, 5 Mar 2022 06:29:27 +0300 Subject: [PATCH] Fix VarInt again There still were bugs in other Read functions, this commit should fix them --- src/BinaryEncoding/Binary.Varint.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BinaryEncoding/Binary.Varint.cs b/src/BinaryEncoding/Binary.Varint.cs index 49e81f6..301eec1 100644 --- a/src/BinaryEncoding/Binary.Varint.cs +++ b/src/BinaryEncoding/Binary.Varint.cs @@ -232,7 +232,7 @@ public static int Read(Stream stream, out ulong value) { return i + 1; } - value |= (ulong)(b << s); + value |= (ulong)(b) << s; return i + 1; } value |= (ulong)(b & 0x7f) << s; @@ -282,7 +282,7 @@ public static int Read(Stream stream, out long value) { return value; } - value |= (ulong)(buffer[0] << s); + value |= (ulong)(buffer[0]) << s; return value; } value |= (ulong)(buffer[0] & 0x7f) << s;