summaryrefslogtreecommitdiff
path: root/core/fxcrt/fx_basic_buffer.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-08-30 13:23:44 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-30 17:33:36 +0000
commitccd5be05f61c85754daf5c8155f4932f6d35a55a (patch)
tree7ec719348aed7e92cdb8b28887bffcf583a7c819 /core/fxcrt/fx_basic_buffer.cpp
parent68eefa6a6f6bbab73000a29e2cac3e104be1cc81 (diff)
downloadpdfium-ccd5be05f61c85754daf5c8155f4932f6d35a55a.tar.xz
Move CFX_BitStream to its own file
This CL moves the CFX_BitStream code out of fx_basic and into cfx_bitstream. Bug: pdfium:867 Change-Id: I5b7e6190a7db1fe1d24feb6bd676035a5c73ee92 Reviewed-on: https://pdfium-review.googlesource.com/12350 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcrt/fx_basic_buffer.cpp')
-rw-r--r--core/fxcrt/fx_basic_buffer.cpp44
1 files changed, 0 insertions, 44 deletions
diff --git a/core/fxcrt/fx_basic_buffer.cpp b/core/fxcrt/fx_basic_buffer.cpp
index 310aec7faf..b93c1bc9da 100644
--- a/core/fxcrt/fx_basic_buffer.cpp
+++ b/core/fxcrt/fx_basic_buffer.cpp
@@ -145,47 +145,3 @@ CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideTextBuf& buf) {
AppendBlock(buf.m_pBuffer.get(), buf.m_DataSize);
return *this;
}
-
-void CFX_BitStream::Init(const uint8_t* pData, uint32_t dwSize) {
- m_pData = pData;
- m_BitSize = dwSize * 8;
- m_BitPos = 0;
-}
-
-void CFX_BitStream::ByteAlign() {
- m_BitPos = (m_BitPos + 7) & ~7;
-}
-
-uint32_t CFX_BitStream::GetBits(uint32_t nBits) {
- if (nBits > m_BitSize || m_BitPos + nBits > m_BitSize)
- return 0;
-
- if (nBits == 1) {
- int bit = (m_pData[m_BitPos / 8] & (1 << (7 - m_BitPos % 8))) ? 1 : 0;
- m_BitPos++;
- return bit;
- }
-
- uint32_t byte_pos = m_BitPos / 8;
- uint32_t bit_pos = m_BitPos % 8;
- uint32_t bit_left = nBits;
- uint32_t result = 0;
- if (bit_pos) {
- if (8 - bit_pos >= bit_left) {
- result =
- (m_pData[byte_pos] & (0xff >> bit_pos)) >> (8 - bit_pos - bit_left);
- m_BitPos += bit_left;
- return result;
- }
- bit_left -= 8 - bit_pos;
- result = (m_pData[byte_pos++] & ((1 << (8 - bit_pos)) - 1)) << bit_left;
- }
- while (bit_left >= 8) {
- bit_left -= 8;
- result |= m_pData[byte_pos++] << bit_left;
- }
- if (bit_left)
- result |= m_pData[byte_pos] >> (8 - bit_left);
- m_BitPos += nBits;
- return result;
-}