1
0
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:
lidgren
2012-08-29 11:47:46 +00:00
parent 05d2efd337
commit 84003ba9db
3 changed files with 4 additions and 1 deletions

View File

@@ -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;

View File

@@ -17,6 +17,8 @@ namespace UnitTests
Console.WriteLine("Unique identifier is " + NetUtility.ToHexString(peer.UniqueIdentifier));
NetBitWriterTests.Run();
ReadWriteTests.Run(peer);
NetQueueTests.Run();

View File

@@ -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" />