mirror of https://github.com/status-im/qzxing.git
Revert "Started the transission of char containers to unsinged char. By changing BitArray, there are 100 our of 1100 more tests that succeed."
This reverts commit afbe30fe0d
.
This commit is contained in:
parent
afbe30fe0d
commit
bac12b2dc8
|
@ -90,12 +90,12 @@ bool BitArray::isRange(int start, int end, bool value) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<unsigned char>& BitArray::getBitArray() {
|
vector<int>& BitArray::getBitArray() {
|
||||||
return bits->values();
|
return bits->values();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitArray::reverse() {
|
void BitArray::reverse() {
|
||||||
ArrayRef<unsigned char> newBits(bits->size());
|
ArrayRef<int> 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<unsigned char> newBits = makeArray(size);
|
ArrayRef<int> 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<unsigned char>& array, int offset, int numBytes) const
|
void BitArray::toBytes(int bitOffset, std::vector<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<unsigned char>& array, int off
|
||||||
}
|
}
|
||||||
bitOffset++;
|
bitOffset++;
|
||||||
}
|
}
|
||||||
array[offset + i] = (unsigned char) theByte;
|
array[offset + i] = (char) theByte;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int size;
|
int size;
|
||||||
ArrayRef<unsigned char> bits;
|
ArrayRef<int> 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<unsigned char>& getBitArray();
|
std::vector<int>& 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<unsigned char>& array, int offset, int numBytes) const;
|
void toBytes(int bitOffset, std::vector<char>& array, int offset, int numBytes) const;
|
||||||
|
|
||||||
static ArrayRef<unsigned char> makeArray(int size) {
|
static ArrayRef<int> makeArray(int size) {
|
||||||
return ArrayRef<unsigned char>((size + 31) / 32);
|
return ArrayRef<int>((size + 31) / 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reverse();
|
void reverse();
|
||||||
|
|
Loading…
Reference in New Issue