1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-16 07:06:30 +09:00

NetConnection.LocalHailMessage exposed. WriteVariableInt64 and ReadVariableInt64 added.

This commit is contained in:
lidgren
2010-12-28 13:13:00 +00:00
parent b83ec10d8d
commit eb056bc9aa
4 changed files with 58 additions and 3 deletions

View File

@@ -429,6 +429,24 @@ namespace Lidgren.Network
return retval;
}
/// <summary>
/// Write Base128 encoded variable sized signed integer
/// </summary>
/// <returns>number of bytes written</returns>
public int WriteVariableInt64(Int64 value)
{
int retval = 1;
UInt64 num1 = (UInt64)((value << 1) ^ (value >> 31));
while (num1 >= 0x80)
{
this.Write((byte)(num1 | 0x80));
num1 = num1 >> 7;
retval++;
}
this.Write((byte)num1);
return retval;
}
/// <summary>
/// Write Base128 encoded variable sized unsigned integer
/// </summary>