Skip to content

Commit 2d54b25

Browse files
committed
decode 'int8' as sbyte and 'uint8' as byte. #139
1 parent 112bd0b commit 2d54b25

File tree

1 file changed

+3
-3
lines changed
  • Assets/Plugins/Colyseus/Serializer/Schema

1 file changed

+3
-3
lines changed

Assets/Plugins/Colyseus/Serializer/Schema/Decoder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,12 @@ public float DecodeNumber(byte[] bytes, Iterator it)
154154
return float.NaN;
155155
}
156156

157-
public int DecodeInt8(byte[] bytes, Iterator it)
157+
public sbyte DecodeInt8(byte[] bytes, Iterator it)
158158
{
159-
return ((int)DecodeUint8(bytes, it)) << 24 >> 24;
159+
return Convert.ToSByte((DecodeUint8(bytes, it)) << 24 >> 24);
160160
}
161161

162-
public uint DecodeUint8(byte[] bytes, Iterator it)
162+
public byte DecodeUint8(byte[] bytes, Iterator it)
163163
{
164164
return bytes[it.Offset++];
165165
}

0 commit comments

Comments
 (0)