Updated comment for QrCode.getNumRawDataModules() in all language versions.

This commit is contained in:
Project Nayuki 2017-05-06 11:51:21 +00:00
parent 84dd6f4e07
commit 652ee37f59
5 changed files with 13 additions and 13 deletions

View File

@ -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 // 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. // 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) { testable int getNumRawDataModules(int version) {
assert(qrcodegen_VERSION_MIN <= version && version <= qrcodegen_VERSION_MAX); assert(qrcodegen_VERSION_MIN <= version && version <= qrcodegen_VERSION_MAX);
int result = (16 * version + 128) * version + 64; int result = (16 * version + 128) * version + 64;

View File

@ -222,9 +222,9 @@ class QrCode final {
private: static std::vector<int> getAlignmentPatternPositions(int ver); private: static std::vector<int> getAlignmentPatternPositions(int ver);
// Returns the number of raw data modules (bits) available at the given version number. // Returns the number of data bits that can be stored in a QR Code of the given version number, after
// These data modules are used for both user data codewords and error correction codewords. // all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
// This stateless pure function could be implemented as a 40-entry lookup table. // The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
private: static int getNumRawDataModules(int ver); private: static int getNumRawDataModules(int ver);

View File

@ -682,9 +682,9 @@ public final class QrCode {
} }
// Returns the number of raw data modules (bits) available at the given version number. // Returns the number of data bits that can be stored in a QR Code of the given version number, after
// These data modules are used for both user data codewords and error correction codewords. // all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
// This stateless pure function could be implemented as a 40-entry lookup table. // The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
private static int getNumRawDataModules(int ver) { private static int getNumRawDataModules(int ver) {
if (ver < 1 || ver > 40) if (ver < 1 || ver > 40)
throw new IllegalArgumentException("Version number out of range"); throw new IllegalArgumentException("Version number out of range");

View File

@ -642,9 +642,9 @@ var qrcodegen = new function() {
}; };
// Returns the number of raw data modules (bits) available at the given version number. // Returns the number of data bits that can be stored in a QR Code of the given version number, after
// These data modules are used for both user data codewords and error correction codewords. // all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
// This stateless pure function could be implemented as a 40-entry lookup table. // The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
QrCode.getNumRawDataModules = function(ver) { QrCode.getNumRawDataModules = function(ver) {
if (ver < 1 || ver > 40) if (ver < 1 || ver > 40)
throw "Version number out of range"; throw "Version number out of range";

View File

@ -521,9 +521,9 @@ class QrCode(object):
@staticmethod @staticmethod
def _get_num_raw_data_modules(ver): def _get_num_raw_data_modules(ver):
"""Returns the number of raw data modules (bits) available at the given version number. """Returns the number of data bits that can be stored in a QR Code of the given version number, after
These data modules are used for both user data codewords and error correction codewords. all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
This stateless pure function could be implemented as a 40-entry lookup table.""" The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table."""
if not 1 <= ver <= 40: if not 1 <= ver <= 40:
raise ValueError("Version number out of range") raise ValueError("Version number out of range")
result = (16 * ver + 128) * ver + 64 result = (16 * ver + 128) * ver + 64