mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 00:38:21 +00:00
Merge pull request #285 from CharlesVaneenoo/improve_putBits
improve putBits
This commit is contained in:
@@ -242,13 +242,12 @@ public final class GamePacketBuilder {
|
|||||||
buffer.setByte(bytePos++, tmp);
|
buffer.setByte(bytePos++, tmp);
|
||||||
numBits -= bitOffset;
|
numBits -= bitOffset;
|
||||||
}
|
}
|
||||||
|
int tmp = buffer.getByte(bytePos);
|
||||||
if (numBits == bitOffset) {
|
if (numBits == bitOffset) {
|
||||||
int tmp = buffer.getByte(bytePos);
|
|
||||||
tmp &= ~DataConstants.BIT_MASK[bitOffset];
|
tmp &= ~DataConstants.BIT_MASK[bitOffset];
|
||||||
tmp |= value & DataConstants.BIT_MASK[bitOffset];
|
tmp |= value & DataConstants.BIT_MASK[bitOffset];
|
||||||
buffer.setByte(bytePos, tmp);
|
buffer.setByte(bytePos, tmp);
|
||||||
} else {
|
} else {
|
||||||
int tmp = buffer.getByte(bytePos);
|
|
||||||
tmp &= ~(DataConstants.BIT_MASK[numBits] << bitOffset - numBits);
|
tmp &= ~(DataConstants.BIT_MASK[numBits] << bitOffset - numBits);
|
||||||
tmp |= (value & DataConstants.BIT_MASK[numBits]) << bitOffset - numBits;
|
tmp |= (value & DataConstants.BIT_MASK[numBits]) << bitOffset - numBits;
|
||||||
buffer.setByte(bytePos, tmp);
|
buffer.setByte(bytePos, tmp);
|
||||||
|
|||||||
Reference in New Issue
Block a user