diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2012-06-13 13:05:30 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2012-06-13 13:05:30 +0400 |
commit | 0b9ec9a361f62ce15fc58763ca8b533afe405973 (patch) | |
tree | 02fb318875748db7e28f0b303d9907e58d69ca8c /src/DSUtil/GolombBuffer.cpp | |
parent | d3b052fb035d8b242e4b328722f4ed7ac84ee20c (diff) |
apply the new astyle command; use 4 spaces for indentation and k&r style
Note: if you have any local patches just run astyle.bat
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@5110 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/DSUtil/GolombBuffer.cpp')
-rw-r--r-- | src/DSUtil/GolombBuffer.cpp | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/src/DSUtil/GolombBuffer.cpp b/src/DSUtil/GolombBuffer.cpp index 5eeb9ffb1..1edb0167b 100644 --- a/src/DSUtil/GolombBuffer.cpp +++ b/src/DSUtil/GolombBuffer.cpp @@ -25,92 +25,92 @@ CGolombBuffer::CGolombBuffer(BYTE* pBuffer, int nSize)
{
- m_pBuffer = pBuffer;
- m_nSize = nSize;
+ m_pBuffer = pBuffer;
+ m_nSize = nSize;
- Reset();
+ Reset();
}
UINT64 CGolombBuffer::BitRead(int nBits, bool fPeek)
{
- // ASSERT(nBits >= 0 && nBits <= 64);
+ // ASSERT(nBits >= 0 && nBits <= 64);
- while (m_bitlen < nBits) {
- m_bitbuff <<= 8;
+ while (m_bitlen < nBits) {
+ m_bitbuff <<= 8;
- if (m_nBitPos >= m_nSize) {
- return 0;
- }
+ if (m_nBitPos >= m_nSize) {
+ return 0;
+ }
- *(BYTE*)&m_bitbuff = m_pBuffer[m_nBitPos++];
- m_bitlen += 8;
- }
+ *(BYTE*)&m_bitbuff = m_pBuffer[m_nBitPos++];
+ m_bitlen += 8;
+ }
- int bitlen = m_bitlen - nBits;
+ int bitlen = m_bitlen - nBits;
- UINT64 ret = (m_bitbuff >> bitlen) & ((1ui64 << nBits) - 1);
+ UINT64 ret = (m_bitbuff >> bitlen) & ((1ui64 << nBits) - 1);
- if (!fPeek) {
- m_bitbuff &= ((1ui64 << bitlen) - 1);
- m_bitlen = bitlen;
- }
+ if (!fPeek) {
+ m_bitbuff &= ((1ui64 << bitlen) - 1);
+ m_bitlen = bitlen;
+ }
- return ret;
+ return ret;
}
UINT64 CGolombBuffer::UExpGolombRead()
{
- int n = -1;
- for (BYTE b = 0; !b; n++) {
- b = (BYTE)BitRead(1);
- }
- return (1ui64 << n) - 1 + BitRead(n);
+ int n = -1;
+ for (BYTE b = 0; !b; n++) {
+ b = (BYTE)BitRead(1);
+ }
+ return (1ui64 << n) - 1 + BitRead(n);
}
INT64 CGolombBuffer::SExpGolombRead()
{
- UINT64 k = UExpGolombRead();
- return ((k&1) ? 1 : -1) * ((k + 1) >> 1);
+ UINT64 k = UExpGolombRead();
+ return ((k & 1) ? 1 : -1) * ((k + 1) >> 1);
}
void CGolombBuffer::BitByteAlign()
{
- m_bitlen &= ~7;
+ m_bitlen &= ~7;
}
int CGolombBuffer::GetPos()
{
- return m_nBitPos - (m_bitlen>>3);
+ return m_nBitPos - (m_bitlen >> 3);
}
void CGolombBuffer::ReadBuffer(BYTE* pDest, int nSize)
{
- ASSERT (m_nBitPos + nSize <= m_nSize);
- ASSERT (m_bitlen == 0);
- nSize = min (nSize, m_nSize - m_nBitPos);
+ ASSERT(m_nBitPos + nSize <= m_nSize);
+ ASSERT(m_bitlen == 0);
+ nSize = min(nSize, m_nSize - m_nBitPos);
- memcpy (pDest, m_pBuffer+m_nBitPos, nSize);
- m_nBitPos += nSize;
+ memcpy(pDest, m_pBuffer + m_nBitPos, nSize);
+ m_nBitPos += nSize;
}
void CGolombBuffer::Reset()
{
- m_nBitPos = 0;
- m_bitlen = 0;
- m_bitbuff = 0;
+ m_nBitPos = 0;
+ m_bitlen = 0;
+ m_bitbuff = 0;
}
void CGolombBuffer::Reset(BYTE* pNewBuffer, int nNewSize)
{
- m_pBuffer = pNewBuffer;
- m_nSize = nNewSize;
+ m_pBuffer = pNewBuffer;
+ m_nSize = nNewSize;
- Reset();
+ Reset();
}
void CGolombBuffer::SkipBytes(int nCount)
{
- m_nBitPos += nCount;
- m_bitlen = 0;
- m_bitbuff = 0;
+ m_nBitPos += nCount;
+ m_bitlen = 0;
+ m_bitbuff = 0;
}
|