Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / other-licenses / 7zstub / src / 7zip / Common / LSBFEncoder.cpp
bloba0ed300c6ea43639aba96f0d32bc845a5be3d0e7
1 // LSBFEncoder.cpp
3 #include "StdAfx.h"
5 #include "LSBFEncoder.h"
6 #include "Common/Defs.h"
8 namespace NStream {
9 namespace NLSBF {
11 void CEncoder::WriteBits(UInt32 value, int numBits)
13 while(numBits > 0)
15 if (numBits < m_BitPos)
17 m_CurByte |= (value & ((1 << numBits) - 1)) << (8 - m_BitPos);
18 m_BitPos -= numBits;
19 return;
21 numBits -= m_BitPos;
22 m_Stream.WriteByte((Byte)(m_CurByte | (value << (8 - m_BitPos))));
23 value >>= m_BitPos;
24 m_BitPos = 8;
25 m_CurByte = 0;