1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Properly read the sign bit

This commit is contained in:
Martin Tůma 2021-11-08 22:10:36 +01:00
parent ca5b7d72c4
commit 9bfc7e8b89

View File

@ -125,14 +125,12 @@ bool HuffmanDeltaStream<BitStream>::readDelta(int sign, qint32 &delta)
return false; return false;
if (symbol && !sign) { if (symbol && !sign) {
if (!this->_symbolDataSize) quint32 bit;
if (!this->read(1, bit))
return false; return false;
else { sign = bit ? -1 : 1;
sign = ((1U << (this->_symbolDataSize - 1)) & this->_symbolData)
? -1 : 1;
this->_symbolDataSize--;
}
} }
delta = sign * symbol; delta = sign * symbol;
return true; return true;