Renamed variable in QrCode.drawVersion() in all language versions.

This commit is contained in:
Project Nayuki 2018-08-22 19:52:50 +00:00
parent 23ae555dde
commit 62e73f787a
7 changed files with 23 additions and 23 deletions

View File

@ -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;
}
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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)

View File

@ -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);

View File

@ -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);