You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-16 15:16:33 +09:00
Fix for WriteByte outputting too many bits, unit test added
This commit is contained in:
@@ -105,7 +105,7 @@ namespace Lidgren.Network
|
||||
NetException.Assert(((numberOfBits >= 1) && (numberOfBits <= 8)), "Must write between 1 and 8 bits!");
|
||||
|
||||
// mask out unwanted bits in the source
|
||||
byte isrc = (byte)((uint)source & ((~(uint)0) >> (8 - numberOfBits)));
|
||||
byte isrc = (byte)(source & (0x000000FF >> (8 - numberOfBits)));
|
||||
|
||||
int bytePtr = destBitOffset >> 3;
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ namespace UnitTests
|
||||
|
||||
Console.WriteLine("Unique identifier is " + NetUtility.ToHexString(peer.UniqueIdentifier));
|
||||
|
||||
NetBitWriterTests.Run();
|
||||
|
||||
ReadWriteTests.Run(peer);
|
||||
|
||||
NetQueueTests.Run();
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
<Compile Include="BitVectorTests.cs" />
|
||||
<Compile Include="EncryptionTests.cs" />
|
||||
<Compile Include="MiscTests.cs" />
|
||||
<Compile Include="NetBitWriterTests.cs" />
|
||||
<Compile Include="NetQueueTests.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
||||
Reference in New Issue
Block a user