|
|
@ -252,13 +252,13 @@ void QrCode::drawVersion() {
|
|
|
|
int rem = version; // version is uint6, in the range [7, 40]
|
|
|
|
int rem = version; // version is uint6, in the range [7, 40]
|
|
|
|
for (int i = 0; i < 12; i++)
|
|
|
|
for (int i = 0; i < 12; i++)
|
|
|
|
rem = (rem << 1) ^ ((rem >> 11) * 0x1F25);
|
|
|
|
rem = (rem << 1) ^ ((rem >> 11) * 0x1F25);
|
|
|
|
long data = (long)version << 12 | rem; // uint18
|
|
|
|
long bits = (long)version << 12 | rem; // uint18
|
|
|
|
if (data >> 18 != 0)
|
|
|
|
if (bits >> 18 != 0)
|
|
|
|
throw std::logic_error("Assertion error");
|
|
|
|
throw std::logic_error("Assertion error");
|
|
|
|
|
|
|
|
|
|
|
|
// Draw two copies
|
|
|
|
// Draw two copies
|
|
|
|
for (int i = 0; i < 18; i++) {
|
|
|
|
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;
|
|
|
|
int a = size - 11 + i % 3, b = i / 3;
|
|
|
|
setFunctionModule(a, b, bit);
|
|
|
|
setFunctionModule(a, b, bit);
|
|
|
|
setFunctionModule(b, a, bit);
|
|
|
|
setFunctionModule(b, a, bit);
|
|
|
|