mirror of
https://github.com/status-im/QR-Code-generator.git
synced 2026-08-31 01:31:10 +00:00
Simplified the argument check in BitBuffer.appendBits() by tightening the input range, also removed some parentheses.
This commit is contained in:
+1
-1
@@ -39,7 +39,7 @@ std::vector<std::uint8_t> BitBuffer::getBytes() const {
|
||||
|
||||
|
||||
void BitBuffer::appendBits(std::uint32_t val, int len) {
|
||||
if (len < 0 || len > 32 || (len < 32 && (val >> len) != 0))
|
||||
if (len < 0 || len > 31 || val >> len != 0)
|
||||
throw "Value out of range";
|
||||
for (int i = len - 1; i >= 0; i--) // Append bit by bit
|
||||
this->push_back(((val >> i) & 1) != 0);
|
||||
|
||||
Reference in New Issue
Block a user