mirror of https://github.com/status-im/qzxing.git
Started the transission of char containers to unsinged char. By changing BitArray, there are 100 our of 1100 more tests that succeed.
This commit is contained in:
parent
995c01a5c8
commit
afbe30fe0d
|
@ -90,12 +90,12 @@ bool BitArray::isRange(int start, int end, bool value) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<int>& BitArray::getBitArray() {
|
vector<unsigned char>& BitArray::getBitArray() {
|
||||||
return bits->values();
|
return bits->values();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitArray::reverse() {
|
void BitArray::reverse() {
|
||||||
ArrayRef<int> newBits(bits->size());
|
ArrayRef<unsigned char> newBits(bits->size());
|
||||||
int size = this->size;
|
int size = this->size;
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
if (get(size - i - 1)) {
|
if (get(size - i - 1)) {
|
||||||
|
@ -197,7 +197,7 @@ void BitArray::ensureCapacity(int size)
|
||||||
{
|
{
|
||||||
if (size > bits->size() * 32)
|
if (size > bits->size() * 32)
|
||||||
{
|
{
|
||||||
ArrayRef<int> newBits = makeArray(size);
|
ArrayRef<unsigned char> newBits = makeArray(size);
|
||||||
//memcpy(bits, newBits->, bits->size());
|
//memcpy(bits, newBits->, bits->size());
|
||||||
for (size_t i=0; i<bits->size(); ++i) {
|
for (size_t i=0; i<bits->size(); ++i) {
|
||||||
newBits[i] = bits[i];
|
newBits[i] = bits[i];
|
||||||
|
@ -219,7 +219,7 @@ void BitArray::xor_(const BitArray& other)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitArray::toBytes(int bitOffset, std::vector<char>& array, int offset, int numBytes) const
|
void BitArray::toBytes(int bitOffset, std::vector<unsigned char>& array, int offset, int numBytes) const
|
||||||
{
|
{
|
||||||
if(array.size() < (numBytes + offset))
|
if(array.size() < (numBytes + offset))
|
||||||
array.resize(numBytes + offset);
|
array.resize(numBytes + offset);
|
||||||
|
@ -232,6 +232,6 @@ void BitArray::toBytes(int bitOffset, std::vector<char>& array, int offset, int
|
||||||
}
|
}
|
||||||
bitOffset++;
|
bitOffset++;
|
||||||
}
|
}
|
||||||
array[offset + i] = (char) theByte;
|
array[offset + i] = (unsigned char) theByte;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int size;
|
int size;
|
||||||
ArrayRef<int> bits;
|
ArrayRef<unsigned char> bits;
|
||||||
static const int logBits = ZX_LOG_DIGITS(bitsPerWord);
|
static const int logBits = ZX_LOG_DIGITS(bitsPerWord);
|
||||||
static const int bitsMask = (1 << logBits) - 1;
|
static const int bitsMask = (1 << logBits) - 1;
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public:
|
||||||
void setRange(int start, int end);
|
void setRange(int start, int end);
|
||||||
void clear();
|
void clear();
|
||||||
bool isRange(int start, int end, bool value);
|
bool isRange(int start, int end, bool value);
|
||||||
std::vector<int>& getBitArray();
|
std::vector<unsigned char>& getBitArray();
|
||||||
|
|
||||||
void appendBit(bool bit);
|
void appendBit(bool bit);
|
||||||
void appendBits(int value, int numBits);
|
void appendBits(int value, int numBits);
|
||||||
|
@ -70,10 +70,10 @@ public:
|
||||||
|
|
||||||
void xor_(const BitArray& other);
|
void xor_(const BitArray& other);
|
||||||
|
|
||||||
void toBytes(int bitOffset, std::vector<char>& array, int offset, int numBytes) const;
|
void toBytes(int bitOffset, std::vector<unsigned char>& array, int offset, int numBytes) const;
|
||||||
|
|
||||||
static ArrayRef<int> makeArray(int size) {
|
static ArrayRef<unsigned char> makeArray(int size) {
|
||||||
return ArrayRef<int>((size + 31) / 32);
|
return ArrayRef<unsigned char>((size + 31) / 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reverse();
|
void reverse();
|
||||||
|
|
Loading…
Reference in New Issue