8
9
10
11
12
13
14
15
16
17
18
19
20
21
23#include "fxbarcode/qrcode/BC_QRCoderBitVector.h"
25#include "core/fxcrt/fx_system.h"
26#include "third_party/base/check.h"
33 CHECK(index < m_sizeInBits);
34 int32_t value = m_array[index >> 3] & 0xff;
35 return (value >> (7 - (index & 0x7))) & 1;
39 return (m_sizeInBits + 7) >> 3;
47 DCHECK(bit == 0 || bit == 1);
48 int32_t numBitsInLastByte = m_sizeInBits & 0x7;
49 if (numBitsInLastByte == 0) {
53 m_array[m_sizeInBits >> 3] |= (bit << (7 - numBitsInLastByte));
59 DCHECK(numBits <= 32);
61 int32_t numBitsLeft = numBits;
62 while (numBitsLeft > 0) {
63 if ((m_sizeInBits & 0x7) == 0 && numBitsLeft >= 8) {
64 AppendByte(
static_cast<int8_t>((value >> (numBitsLeft - 8)) & 0xff));
74 for (size_t i = 0; i < bits->Size(); i++)
79 if (m_sizeInBits != other->Size())
82 pdfium::span<
const uint8_t> other_span = other->GetArray();
83 for (size_t i = 0; i < sizeInBytes(); ++i)
84 m_array[i] ^= other_span[i];
93 if ((m_sizeInBits >> 3) == m_array.size())
95 m_array[m_sizeInBits >> 3] = value;
void AppendBits(int32_t value, int32_t numBits)
int32_t At(size_t index) const
size_t sizeInBytes() const
void AppendBitVector(const CBC_QRCoderBitVector *bits)
bool XOR(const CBC_QRCoderBitVector *other)
void AppendBit(int32_t bit)
pdfium::span< const uint8_t > GetArray() const