From 6f45d3b573fa32102c720a655fa650665d7cdbfe Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Wed, 22 Aug 2018 19:56:24 +0000 Subject: [PATCH] Clarified code in QrCode.drawVersion() in 4 language versions. --- cpp/QrCode.cpp | 3 ++- java/io/nayuki/qrcodegen/QrCode.java | 3 ++- javascript/qrcodegen.js | 3 ++- python/qrcodegen.py | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cpp/QrCode.cpp b/cpp/QrCode.cpp index 3357cd6..5c3bbc2 100644 --- a/cpp/QrCode.cpp +++ b/cpp/QrCode.cpp @@ -259,7 +259,8 @@ void QrCode::drawVersion() { // Draw two copies for (int i = 0; i < 18; i++) { bool bit = getBit(bits, i); - int a = size - 11 + i % 3, b = i / 3; + int a = size - 11 + i % 3; + int b = i / 3; setFunctionModule(a, b, bit); setFunctionModule(b, a, bit); } diff --git a/java/io/nayuki/qrcodegen/QrCode.java b/java/io/nayuki/qrcodegen/QrCode.java index 6582fd4..e596001 100644 --- a/java/io/nayuki/qrcodegen/QrCode.java +++ b/java/io/nayuki/qrcodegen/QrCode.java @@ -388,7 +388,8 @@ public final class QrCode { // Draw two copies for (int i = 0; i < 18; i++) { boolean bit = getBit(bits, i); - int a = size - 11 + i % 3, b = i / 3; + int a = size - 11 + i % 3; + int b = i / 3; setFunctionModule(a, b, bit); setFunctionModule(b, a, bit); } diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index b95f77f..e2d9bdc 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -266,7 +266,8 @@ var qrcodegen = new function() { // Draw two copies for (var i = 0; i < 18; i++) { var bit = getBit(bits, i); - var a = size - 11 + i % 3, b = Math.floor(i / 3); + var a = size - 11 + i % 3; + var b = Math.floor(i / 3); setFunctionModule(a, b, bit); setFunctionModule(b, a, bit); } diff --git a/python/qrcodegen.py b/python/qrcodegen.py index db449d9..7b1a537 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -310,7 +310,8 @@ class QrCode(object): # Draw two copies for i in range(18): bit = _get_bit(bits, i) - a, b = self._size - 11 + i % 3, i // 3 + a = self._size - 11 + i % 3 + b = i // 3 self._set_function_module(a, b, bit) self._set_function_module(b, a, bit)