mirror of
https://github.com/status-im/QR-Code-generator.git
synced 2026-08-30 17:21:15 +00:00
Inlined BitBuffer.getBytes() into its single usage (with simplification because the bit length is a multiple of 8) in most language versions, synchronized comment and variable name in Rust version.
This commit is contained in:
+6
-1
@@ -109,8 +109,13 @@ QrCode QrCode::encodeSegments(const vector<QrSegment> &segs, Ecc ecl,
|
||||
for (uint8_t padByte = 0xEC; bb.size() < dataCapacityBits; padByte ^= 0xEC ^ 0x11)
|
||||
bb.appendBits(padByte, 8);
|
||||
|
||||
// Pack bits into bytes in big endian
|
||||
vector<uint8_t> dataCodewords(bb.size() / 8);
|
||||
for (size_t i = 0; i < bb.size(); i++)
|
||||
dataCodewords[i >> 3] |= (bb.at(i) ? 1 : 0) << (7 - (i & 7));
|
||||
|
||||
// Create the QR Code object
|
||||
return QrCode(version, ecl, bb.getBytes(), mask);
|
||||
return QrCode(version, ecl, dataCodewords, mask);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user