From 2d54b25c1b8118191a627556d06aa14313f269f8 Mon Sep 17 00:00:00 2001 From: Endel Dreyer Date: Wed, 7 Apr 2021 11:39:13 -0300 Subject: [PATCH] decode 'int8' as sbyte and 'uint8' as byte. #139 --- Assets/Plugins/Colyseus/Serializer/Schema/Decoder.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Assets/Plugins/Colyseus/Serializer/Schema/Decoder.cs b/Assets/Plugins/Colyseus/Serializer/Schema/Decoder.cs index 68f0d495..b0ad82dd 100644 --- a/Assets/Plugins/Colyseus/Serializer/Schema/Decoder.cs +++ b/Assets/Plugins/Colyseus/Serializer/Schema/Decoder.cs @@ -154,12 +154,12 @@ public float DecodeNumber(byte[] bytes, Iterator it) return float.NaN; } - public int DecodeInt8(byte[] bytes, Iterator it) + public sbyte DecodeInt8(byte[] bytes, Iterator it) { - return ((int)DecodeUint8(bytes, it)) << 24 >> 24; + return Convert.ToSByte((DecodeUint8(bytes, it)) << 24 >> 24); } - public uint DecodeUint8(byte[] bytes, Iterator it) + public byte DecodeUint8(byte[] bytes, Iterator it) { return bytes[it.Offset++]; }