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

Added missing NetUtility.BitsToHoldUInt64

This commit is contained in:
Michael Lidgren
2015-11-25 00:15:39 +01:00
parent 937d023c39
commit 1414e34291
2 changed files with 15 additions and 0 deletions

View File

@@ -282,6 +282,18 @@ namespace Lidgren.Network
return bits;
}
/// <summary>
/// Returns how many bits are necessary to hold a certain number
/// </summary>
[CLSCompliant(false)]
public static int BitsToHoldUInt64(ulong value)
{
int bits = 1;
while ((value >>= 1) != 0)
bits++;
return bits;
}
/// <summary>
/// Returns how many bytes are required to hold a certain number of bits
/// </summary>