Updated a comment in getAlignmentPatternPositions() in most language versions (except JavaScript).

pull/16/head
Project Nayuki 8 years ago
parent 9f2c8d9e96
commit 49f6538682

@ -630,9 +630,10 @@ testable int getAlignmentPatternPositions(int version, uint8_t result[7]) {
int qrsize = version * 4 + 17;
int numAlign = version / 7 + 2;
int step;
if (version != 32)
step = (version * 4 + numAlign * 2 + 1) / (2 * numAlign - 2) * 2; // ceil((qrsize - 13) / (2*numAlign - 2)) * 2
else // C-C-C-Combo breaker!
if (version != 32) {
// ceil((qrsize - 13) / (2*numAlign - 2)) * 2
step = (version * 4 + numAlign * 2 + 1) / (2 * numAlign - 2) * 2;
} else // C-C-C-Combo breaker!
step = 26;
for (int i = numAlign - 1, pos = qrsize - 7; i >= 1; i--, pos -= step)
result[i] = pos;

@ -507,9 +507,10 @@ vector<int> QrCode::getAlignmentPatternPositions(int ver) {
else {
int numAlign = ver / 7 + 2;
int step;
if (ver != 32)
step = (ver * 4 + numAlign * 2 + 1) / (2 * numAlign - 2) * 2; // ceil((size - 13) / (2*numAlign - 2)) * 2
else // C-C-C-Combo breaker!
if (ver != 32) {
// ceil((size - 13) / (2*numAlign - 2)) * 2
step = (ver * 4 + numAlign * 2 + 1) / (2 * numAlign - 2) * 2;
} else // C-C-C-Combo breaker!
step = 26;
vector<int> result;

@ -668,9 +668,10 @@ public final class QrCode {
else {
int numAlign = ver / 7 + 2;
int step;
if (ver != 32)
step = (ver * 4 + numAlign * 2 + 1) / (2 * numAlign - 2) * 2; // ceil((size - 13) / (2*numAlign - 2)) * 2
else // C-C-C-Combo breaker!
if (ver != 32) {
// ceil((size - 13) / (2*numAlign - 2)) * 2
step = (ver * 4 + numAlign * 2 + 1) / (2 * numAlign - 2) * 2;
} else // C-C-C-Combo breaker!
step = 26;
int[] result = new int[numAlign];

@ -506,7 +506,8 @@ class QrCode(object):
else:
numalign = ver // 7 + 2
if ver != 32:
step = (ver * 4 + numalign * 2 + 1) // (2 * numalign - 2) * 2 # ceil((size - 13) / (2*numalign - 2)) * 2
# ceil((size - 13) / (2*numalign - 2)) * 2
step = (ver * 4 + numalign * 2 + 1) // (2 * numalign - 2) * 2
else: # C-C-C-Combo breaker!
step = 26
result = [6]

Loading…
Cancel
Save