diff --git a/c/qrcodegen.c b/c/qrcodegen.c index 112e974..e662341 100644 --- a/c/qrcodegen.c +++ b/c/qrcodegen.c @@ -403,16 +403,16 @@ static void drawWhiteFunctionModules(uint8_t qrcode[], int version) { int rem = version; // version is uint6, in the range [7, 40] for (int i = 0; i < 12; i++) rem = (rem << 1) ^ ((rem >> 11) * 0x1F25); - long data = (long)version << 12 | rem; // uint18 - assert(data >> 18 == 0); + long bits = (long)version << 12 | rem; // uint18 + assert(bits >> 18 == 0); // Draw two copies for (int i = 0; i < 6; i++) { for (int j = 0; j < 3; j++) { int k = qrsize - 11 + j; - setModule(qrcode, k, i, (data & 1) != 0); - setModule(qrcode, i, k, (data & 1) != 0); - data >>= 1; + setModule(qrcode, k, i, (bits & 1) != 0); + setModule(qrcode, i, k, (bits & 1) != 0); + bits >>= 1; } } } diff --git a/cpp/QrCode.cpp b/cpp/QrCode.cpp index 668bdb9..3357cd6 100644 --- a/cpp/QrCode.cpp +++ b/cpp/QrCode.cpp @@ -252,13 +252,13 @@ void QrCode::drawVersion() { int rem = version; // version is uint6, in the range [7, 40] for (int i = 0; i < 12; i++) rem = (rem << 1) ^ ((rem >> 11) * 0x1F25); - long data = (long)version << 12 | rem; // uint18 - if (data >> 18 != 0) + long bits = (long)version << 12 | rem; // uint18 + if (bits >> 18 != 0) throw std::logic_error("Assertion error"); // Draw two copies for (int i = 0; i < 18; i++) { - bool bit = getBit(data, i); + bool bit = getBit(bits, i); int a = size - 11 + i % 3, 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 8a551b1..6582fd4 100644 --- a/java/io/nayuki/qrcodegen/QrCode.java +++ b/java/io/nayuki/qrcodegen/QrCode.java @@ -382,12 +382,12 @@ public final class QrCode { int rem = version; // version is uint6, in the range [7, 40] for (int i = 0; i < 12; i++) rem = (rem << 1) ^ ((rem >>> 11) * 0x1F25); - int data = version << 12 | rem; // uint18 - assert data >>> 18 == 0; + int bits = version << 12 | rem; // uint18 + assert bits >>> 18 == 0; // Draw two copies for (int i = 0; i < 18; i++) { - boolean bit = getBit(data, i); + boolean bit = getBit(bits, i); int a = size - 11 + i % 3, b = i / 3; setFunctionModule(a, b, bit); setFunctionModule(b, a, bit); diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index 36a0384..b95f77f 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -259,13 +259,13 @@ var qrcodegen = new function() { var rem = version; // version is uint6, in the range [7, 40] for (var i = 0; i < 12; i++) rem = (rem << 1) ^ ((rem >>> 11) * 0x1F25); - var data = version << 12 | rem; // uint18 - if (data >>> 18 != 0) + var bits = version << 12 | rem; // uint18 + if (bits >>> 18 != 0) throw "Assertion error"; // Draw two copies for (var i = 0; i < 18; i++) { - var bit = getBit(data, i); + var bit = getBit(bits, i); var a = size - 11 + i % 3, b = Math.floor(i / 3); setFunctionModule(a, b, bit); setFunctionModule(b, a, bit); diff --git a/python/qrcodegen.py b/python/qrcodegen.py index 8f0fbdb..db449d9 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -304,12 +304,12 @@ class QrCode(object): rem = self._version # version is uint6, in the range [7, 40] for _ in range(12): rem = (rem << 1) ^ ((rem >> 11) * 0x1F25) - data = self._version << 12 | rem # uint18 - assert data >> 18 == 0 + bits = self._version << 12 | rem # uint18 + assert bits >> 18 == 0 # Draw two copies for i in range(18): - bit = _get_bit(data, i) + bit = _get_bit(bits, i) a, b = self._size - 11 + i % 3, i // 3 self._set_function_module(a, b, bit) self._set_function_module(b, a, bit) diff --git a/rust/src/lib.rs b/rust/src/lib.rs index dbeec47..c4f5f59 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -350,12 +350,12 @@ impl QrCode { for _ in 0 .. 12 { rem = (rem << 1) ^ ((rem >> 11) * 0x1F25); } - let data: u32 = (self.version.value() as u32) << 12 | rem; // uint18 - assert!(data >> 18 == 0, "Assertion error"); + let bits: u32 = (self.version.value() as u32) << 12 | rem; // uint18 + assert!(bits >> 18 == 0, "Assertion error"); // Draw two copies for i in 0 .. 18 { - let bit: bool = get_bit(data, i); + let bit: bool = get_bit(bits, i); let a: i32 = self.size - 11 + i % 3; let b: i32 = i / 3; self.set_function_module(a, b, bit); diff --git a/typescript/qrcodegen.ts b/typescript/qrcodegen.ts index 0101a46..081cea1 100644 --- a/typescript/qrcodegen.ts +++ b/typescript/qrcodegen.ts @@ -322,13 +322,13 @@ namespace qrcodegen { let rem: int = this.version; // version is uint6, in the range [7, 40] for (let i = 0; i < 12; i++) rem = (rem << 1) ^ ((rem >>> 11) * 0x1F25); - let data: int = this.version << 12 | rem; // uint18 - if (data >>> 18 != 0) + let bits: int = this.version << 12 | rem; // uint18 + if (bits >>> 18 != 0) throw "Assertion error"; // Draw two copies for (let i = 0; i < 18; i++) { - let bt: boolean = getBit(data, i); + let bt: boolean = getBit(bits, i); let a: int = this.size - 11 + i % 3; let b: int = Math.floor(i / 3); this.setFunctionModule(a, b, bt);