1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-15 22:56:30 +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;