Deleted comment and calculated the constant in QrCode.getNumRawDataModules() in all language versions except Java, because only the Java code explains the calculation in detail.

pull/39/merge
Project Nayuki 6 years ago
parent f83f201b8d
commit e7d2449957

@ -253,7 +253,7 @@ testable int getNumRawDataModules(int version) {
int numAlign = version / 7 + 2;
result -= (25 * numAlign - 10) * numAlign - 55;
if (version >= 7)
result -= 18 * 2; // Subtract version information
result -= 36;
}
return result;
}

@ -520,7 +520,7 @@ int QrCode::getNumRawDataModules(int ver) {
int numAlign = ver / 7 + 2;
result -= (25 * numAlign - 10) * numAlign - 55;
if (ver >= 7)
result -= 18 * 2; // Subtract version information
result -= 36;
}
return result;
}

@ -628,7 +628,7 @@ var qrcodegen = new function() {
var numAlign = Math.floor(ver / 7) + 2;
result -= (25 * numAlign - 10) * numAlign - 55;
if (ver >= 7)
result -= 18 * 2; // Subtract version information
result -= 36;
}
return result;
};

@ -515,7 +515,7 @@ class QrCode(object):
numalign = ver // 7 + 2
result -= (25 * numalign - 10) * numalign - 55
if ver >= 7:
result -= 18 * 2 # Subtract version information
result -= 36
return result

@ -649,7 +649,7 @@ impl QrCode {
let numalign: usize = (ver as usize) / 7 + 2;
result -= (25 * numalign - 10) * numalign - 55;
if ver >= 7 {
result -= 18 * 2; // Subtract version information
result -= 36;
}
}
result

@ -591,7 +591,7 @@ namespace qrcodegen {
let numAlign: int = Math.floor(ver / 7) + 2;
result -= (25 * numAlign - 10) * numAlign - 55;
if (ver >= 7)
result -= 18 * 2; // Subtract version information
result -= 36;
}
return result;
}

Loading…
Cancel
Save