Simplified an analogous piece of C++ and Rust code.

This commit is contained in:
Project Nayuki
2017-08-28 00:54:44 +00:00
parent eb200b8ebc
commit 5ddb2e9d63
2 changed files with 7 additions and 8 deletions
+3 -4
View File
@@ -81,10 +81,9 @@ QrCode QrCode::encodeSegments(const vector<QrSegment> &segs, const Ecc &ecl,
// Increase the error correction level while the data still fits in the current version number
const Ecc *newEcl = &ecl;
if (boostEcl) {
if (dataUsedBits <= getNumDataCodewords(version, Ecc::MEDIUM ) * 8) newEcl = &Ecc::MEDIUM ;
if (dataUsedBits <= getNumDataCodewords(version, Ecc::QUARTILE) * 8) newEcl = &Ecc::QUARTILE;
if (dataUsedBits <= getNumDataCodewords(version, Ecc::HIGH ) * 8) newEcl = &Ecc::HIGH ;
for (const Ecc *anEcl : vector<const Ecc*>{&Ecc::MEDIUM, &Ecc::QUARTILE, &Ecc::HIGH}) {
if (boostEcl && dataUsedBits <= getNumDataCodewords(version, *anEcl) * 8)
newEcl = anEcl;
}
// Create the data bit string by concatenating all segments