From 652ee37f5966dd5c91efa5cbb7f331c3fd300ed8 Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Sat, 6 May 2017 11:51:21 +0000 Subject: [PATCH] Updated comment for QrCode.getNumRawDataModules() in all language versions. --- c/qrcodegen.c | 2 +- cpp/QrCode.hpp | 6 +++--- java/io/nayuki/qrcodegen/QrCode.java | 6 +++--- javascript/qrcodegen.js | 6 +++--- python/qrcodegen.py | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/c/qrcodegen.c b/c/qrcodegen.c index 5bf50c2..892bf22 100644 --- a/c/qrcodegen.c +++ b/c/qrcodegen.c @@ -406,7 +406,7 @@ testable int getNumDataCodewords(int version, enum qrcodegen_Ecc ecl) { // Returns the number of data bits that can be stored in a QR Code of the given version number, after // all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8. -// The result is in the range [208, 29648]. +// The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table. testable int getNumRawDataModules(int version) { assert(qrcodegen_VERSION_MIN <= version && version <= qrcodegen_VERSION_MAX); int result = (16 * version + 128) * version + 64; diff --git a/cpp/QrCode.hpp b/cpp/QrCode.hpp index 23a47b2..09ce1b3 100644 --- a/cpp/QrCode.hpp +++ b/cpp/QrCode.hpp @@ -222,9 +222,9 @@ class QrCode final { private: static std::vector getAlignmentPatternPositions(int ver); - // Returns the number of raw data modules (bits) available at the given version number. - // These data modules are used for both user data codewords and error correction codewords. - // This stateless pure function could be implemented as a 40-entry lookup table. + // Returns the number of data bits that can be stored in a QR Code of the given version number, after + // all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8. + // The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table. private: static int getNumRawDataModules(int ver); diff --git a/java/io/nayuki/qrcodegen/QrCode.java b/java/io/nayuki/qrcodegen/QrCode.java index 4b3d8b3..684ab12 100644 --- a/java/io/nayuki/qrcodegen/QrCode.java +++ b/java/io/nayuki/qrcodegen/QrCode.java @@ -682,9 +682,9 @@ public final class QrCode { } - // Returns the number of raw data modules (bits) available at the given version number. - // These data modules are used for both user data codewords and error correction codewords. - // This stateless pure function could be implemented as a 40-entry lookup table. + // Returns the number of data bits that can be stored in a QR Code of the given version number, after + // all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8. + // The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table. private static int getNumRawDataModules(int ver) { if (ver < 1 || ver > 40) throw new IllegalArgumentException("Version number out of range"); diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index 736653f..722c54c 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -642,9 +642,9 @@ var qrcodegen = new function() { }; - // Returns the number of raw data modules (bits) available at the given version number. - // These data modules are used for both user data codewords and error correction codewords. - // This stateless pure function could be implemented as a 40-entry lookup table. + // Returns the number of data bits that can be stored in a QR Code of the given version number, after + // all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8. + // The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table. QrCode.getNumRawDataModules = function(ver) { if (ver < 1 || ver > 40) throw "Version number out of range"; diff --git a/python/qrcodegen.py b/python/qrcodegen.py index 7a46cf9..666d658 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -521,9 +521,9 @@ class QrCode(object): @staticmethod def _get_num_raw_data_modules(ver): - """Returns the number of raw data modules (bits) available at the given version number. - These data modules are used for both user data codewords and error correction codewords. - This stateless pure function could be implemented as a 40-entry lookup table.""" + """Returns the number of data bits that can be stored in a QR Code of the given version number, after + all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8. + The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.""" if not 1 <= ver <= 40: raise ValueError("Version number out of range") result = (16 * ver + 128) * ver + 64