summaryrefslogtreecommitdiff
path: root/core/fxcrt/fx_extension.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-05-23 23:41:00 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-23 23:41:00 +0000
commit7e33dbeec78dfa051df52619672133da6a799240 (patch)
treedbcd9f395ed0b89de890af24deae9fa1744fdd8e /core/fxcrt/fx_extension.cpp
parent105ea1c0f896a4a2718f1356cae0dce8c01859cc (diff)
downloadpdfium-7e33dbeec78dfa051df52619672133da6a799240.tar.xz
Remove GetBits32().
Replace it with CFX_BitStream. Change-Id: Ib74657f888b8dec8b6fdad7b49e28d250991c590 Reviewed-on: https://pdfium-review.googlesource.com/32852 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcrt/fx_extension.cpp')
-rw-r--r--core/fxcrt/fx_extension.cpp31
1 files changed, 0 insertions, 31 deletions
diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp
index e27c78d7bf..c754a85508 100644
--- a/core/fxcrt/fx_extension.cpp
+++ b/core/fxcrt/fx_extension.cpp
@@ -167,34 +167,3 @@ size_t FXSYS_ToUTF16BE(uint32_t unicode, char* buf) {
FXSYS_IntToFourHexChars(0xDC00 + unicode % 0x400, buf + 4);
return 8;
}
-
-uint32_t GetBits32(pdfium::span<const uint8_t> pData, int bitpos, int nbits) {
- ASSERT(0 < nbits && nbits <= 32);
- size_t bytepos = bitpos / 8;
- int bitShift;
- int bitMask;
- int dstShift;
- int bitCount = bitpos & 0x07;
- if (nbits < 8 && nbits + bitCount <= 8) {
- bitShift = 8 - nbits - bitCount;
- bitMask = (1 << nbits) - 1;
- dstShift = 0;
- } else {
- bitShift = 0;
- int bitOffset = 8 - bitCount;
- bitMask = (1 << std::min(bitOffset, nbits)) - 1;
- dstShift = nbits - bitOffset;
- }
- uint32_t result = static_cast<uint32_t>(
- (pData[bytepos++] >> bitShift & bitMask) << dstShift);
- while (dstShift >= 8) {
- dstShift -= 8;
- result |= pData[bytepos++] << dstShift;
- }
- if (dstShift > 0) {
- bitShift = 8 - dstShift;
- bitMask = (1 << dstShift) - 1;
- result |= pData[bytepos++] >> bitShift & bitMask;
- }
- return result;
-}