From 2de9610756945f23ec52aef829ea40a7aee7bc43 Mon Sep 17 00:00:00 2001 From: Nayuki Minase Date: Sat, 7 May 2016 19:02:11 +0000 Subject: [PATCH] Added comment about remainder bits in QR symbol in all language versions. --- cpp/QrCode.cpp | 2 ++ java/io/nayuki/qrcodegen/QrCode.java | 2 ++ javascript/qrcodegen.js | 2 ++ python/qrcodegen.py | 2 ++ 4 files changed, 8 insertions(+) diff --git a/cpp/QrCode.cpp b/cpp/QrCode.cpp index 450c4cc..51e6dad 100644 --- a/cpp/QrCode.cpp +++ b/cpp/QrCode.cpp @@ -358,6 +358,8 @@ void qrcodegen::QrCode::drawCodewords(const std::vector &data) { modules.at(y).at(x) = ((data.at(i >> 3) >> (7 - (i & 7))) & 1) != 0; i++; } + // If there are any remainder bits (0 to 7), they are already + // set to 0/false/white when the grid of modules was initialized } } } diff --git a/java/io/nayuki/qrcodegen/QrCode.java b/java/io/nayuki/qrcodegen/QrCode.java index e00a120..3cad230 100644 --- a/java/io/nayuki/qrcodegen/QrCode.java +++ b/java/io/nayuki/qrcodegen/QrCode.java @@ -514,6 +514,8 @@ public final class QrCode { modules[y][x] = ((data[i >>> 3] >>> (7 - (i & 7))) & 1) != 0; i++; } + // If there are any remainder bits (0 to 7), they are already + // set to 0/false/white when the grid of modules was initialized } } } diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index 10d46a6..0b59066 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -415,6 +415,8 @@ var qrcodegen = new function() { modules[y][x] = ((data[i >>> 3] >>> (7 - (i & 7))) & 1) != 0; i++; } + // If there are any remainder bits (0 to 7), they are already + // set to 0/false/white when the grid of modules was initialized } } } diff --git a/python/qrcodegen.py b/python/qrcodegen.py index 97d5c35..f77b9a5 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -409,6 +409,8 @@ class QrCode(object): if not self._isfunction[y][x] and i < len(data) * 8: self._modules[y][x] = ((data[i >> 3] >> (7 - (i & 7))) & 1) != 0 i += 1 + # If there are any remainder bits (0 to 7), they are already + # set to 0/false/white when the grid of modules was initialized assert i == len(data) * 8