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:
favoritas37 2016-05-26 21:11:37 +03:00
parent afbe30fe0d
commit bac12b2dc8
2 changed files with 10 additions and 10 deletions

View File

@ -90,12 +90,12 @@ bool BitArray::isRange(int start, int end, bool value) {
return true;
}
vector<unsigned char>& BitArray::getBitArray() {
vector<int>& BitArray::getBitArray() {
return bits->values();
}
void BitArray::reverse() {
ArrayRef<unsigned char> newBits(bits->size());
ArrayRef<int> newBits(bits->size());
int size = this->size;
for (int i = 0; i < size; i++) {
if (get(size - i - 1)) {
@ -197,7 +197,7 @@ void BitArray::ensureCapacity(int size)
{
if (size > bits->size() * 32)
{
ArrayRef<unsigned char> newBits = makeArray(size);
ArrayRef<int> newBits = makeArray(size);
//memcpy(bits, newBits->, bits->size());
for (size_t i=0; i<bits->size(); ++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))
array.resize(numBytes + offset);
@ -232,6 +232,6 @@ void BitArray::toBytes(int bitOffset, std::vector<unsigned char>& array, int off
}
bitOffset++;
}
array[offset + i] = (unsigned char) theByte;
array[offset + i] = (char) theByte;
}
}

View File

@ -35,7 +35,7 @@ public:
private:
int size;
ArrayRef<unsigned char> bits;
ArrayRef<int> bits;
static const int logBits = ZX_LOG_DIGITS(bitsPerWord);
static const int bitsMask = (1 << logBits) - 1;
@ -61,7 +61,7 @@ public:
void setRange(int start, int end);
void clear();
bool isRange(int start, int end, bool value);
std::vector<unsigned char>& getBitArray();
std::vector<int>& getBitArray();
void appendBit(bool bit);
void appendBits(int value, int numBits);
@ -70,10 +70,10 @@ public:
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) {
return ArrayRef<unsigned char>((size + 31) / 32);
static ArrayRef<int> makeArray(int size) {
return ArrayRef<int>((size + 31) / 32);
}
void reverse();