mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Write/ReadPacked methods obsoleted
This commit is contained in:
parent
3bf5a7ee4b
commit
faa0c1264f
@ -218,6 +218,7 @@ public static ArraySegment<byte> ReadBytesAndSizeSegment(this NetworkReader read
|
||||
}
|
||||
|
||||
// zigzag decoding https://gist.github.com/mfuerstenau/ba870a29e16536fdbaba
|
||||
[Obsolete("Use ReadInt32 instead")]
|
||||
public static int ReadPackedInt32(this NetworkReader reader)
|
||||
{
|
||||
uint data = reader.ReadPackedUInt32();
|
||||
@ -227,15 +228,18 @@ public static int ReadPackedInt32(this NetworkReader reader)
|
||||
// http://sqlite.org/src4/doc/trunk/www/varint.wiki
|
||||
// NOTE: big endian.
|
||||
// Use checked() to force it to throw OverflowException if data is invalid
|
||||
[Obsolete("Use ReadUInt32 instead")]
|
||||
public static uint ReadPackedUInt32(this NetworkReader reader) => checked((uint)reader.ReadPackedUInt64());
|
||||
|
||||
// zigzag decoding https://gist.github.com/mfuerstenau/ba870a29e16536fdbaba
|
||||
[Obsolete("Use ReadInt64 instead")]
|
||||
public static long ReadPackedInt64(this NetworkReader reader)
|
||||
{
|
||||
ulong data = reader.ReadPackedUInt64();
|
||||
return ((long)(data >> 1)) ^ -((long)data & 1);
|
||||
}
|
||||
|
||||
[Obsolete("Use ReadUInt64 instead")]
|
||||
public static ulong ReadPackedUInt64(this NetworkReader reader)
|
||||
{
|
||||
byte a0 = reader.ReadByte();
|
||||
|
@ -271,6 +271,7 @@ public static void WriteBytesAndSizeSegment(this NetworkWriter writer, ArraySegm
|
||||
}
|
||||
|
||||
// zigzag encoding https://gist.github.com/mfuerstenau/ba870a29e16536fdbaba
|
||||
[Obsolete("Use WriteInt32 instead")]
|
||||
public static void WritePackedInt32(this NetworkWriter writer, int i)
|
||||
{
|
||||
uint zigzagged = (uint)((i >> 31) ^ (i << 1));
|
||||
@ -278,6 +279,7 @@ public static void WritePackedInt32(this NetworkWriter writer, int i)
|
||||
}
|
||||
|
||||
// http://sqlite.org/src4/doc/trunk/www/varint.wiki
|
||||
[Obsolete("Use WriteUInt32 instead")]
|
||||
public static void WritePackedUInt32(this NetworkWriter writer, uint value)
|
||||
{
|
||||
// for 32 bit values WritePackedUInt64 writes the
|
||||
@ -286,12 +288,14 @@ public static void WritePackedUInt32(this NetworkWriter writer, uint value)
|
||||
}
|
||||
|
||||
// zigzag encoding https://gist.github.com/mfuerstenau/ba870a29e16536fdbaba
|
||||
[Obsolete("Use WriteInt64 instead")]
|
||||
public static void WritePackedInt64(this NetworkWriter writer, long i)
|
||||
{
|
||||
ulong zigzagged = (ulong)((i >> 63) ^ (i << 1));
|
||||
writer.WritePackedUInt64(zigzagged);
|
||||
}
|
||||
|
||||
[Obsolete("Use WriteUInt64 instead")]
|
||||
public static void WritePackedUInt64(this NetworkWriter writer, ulong value)
|
||||
{
|
||||
if (value <= 240)
|
||||
|
Loading…
Reference in New Issue
Block a user