Skip to content

Commit

Permalink
decode 'int8' as sbyte and 'uint8' as byte. #139
Browse files Browse the repository at this point in the history
  • Loading branch information
endel committed Apr 7, 2021
1 parent 112bd0b commit 2d54b25
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Assets/Plugins/Colyseus/Serializer/Schema/Decoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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++];
}
Expand Down

0 comments on commit 2d54b25

Please sign in to comment.