diff --git a/c/qrcodegen.c b/c/qrcodegen.c index 77a0bda..f197442 100644 --- a/c/qrcodegen.c +++ b/c/qrcodegen.c @@ -964,8 +964,8 @@ testable int getTotalBits(const struct qrcodegen_Segment segs[], size_t len, int } -// Returns the bit width of the segment character count field for the -// given mode at the given version number. The result is in the range [0, 16]. +// Returns the bit width of the character count field for a segment in the given mode +// in a QR Code at the given version number. The result is in the range [0, 16]. static int numCharCountBits(enum qrcodegen_Mode mode, int version) { assert(qrcodegen_VERSION_MIN <= version && version <= qrcodegen_VERSION_MAX); int i = (version + 7) / 17; diff --git a/cpp/QrSegment.hpp b/cpp/QrSegment.hpp index 2bb0c3b..45918ff 100644 --- a/cpp/QrSegment.hpp +++ b/cpp/QrSegment.hpp @@ -60,7 +60,7 @@ class QrSegment final { // The mode indicator bits, which is a uint4 value (range 0 to 15). private: int modeBits; - // Three values for different version ranges. + // Number of character count bits for three different version ranges. private: int numBitsCharCount[3]; @@ -77,7 +77,8 @@ class QrSegment final { public: int getModeBits() const; /* - * (Package-private) Returns the bit width of the segment character count field for this mode object at the given version number. + * (Package-private) Returns the bit width of the character count field for a segment in + * this mode in a QR Code at the given version number. The result is in the range [0, 16]. */ public: int numCharCountBits(int ver) const; diff --git a/java/io/nayuki/qrcodegen/QrSegment.java b/java/io/nayuki/qrcodegen/QrSegment.java index f997be5..927ebaf 100644 --- a/java/io/nayuki/qrcodegen/QrSegment.java +++ b/java/io/nayuki/qrcodegen/QrSegment.java @@ -250,7 +250,7 @@ public final class QrSegment { /** The mode indicator bits, which is a uint4 value (range 0 to 15). */ final int modeBits; - /** Three values for different version ranges. */ + /** Number of character count bits for three different version ranges. */ private final int[] numBitsCharCount; @@ -265,9 +265,10 @@ public final class QrSegment { /*-- Method --*/ /** - * Returns the bit width of the segment character count field for this mode object at the specified version number. + * Returns the bit width of the character count field for a segment + * in this mode in a QR Code at the specified version number. * @param ver the version number, which is between 1 to 40 (inclusive) - * @return the number of bits for the character count, which is between 8 to 16 (inclusive) + * @return the number of bits for the character count, which is between 0 to 16 (inclusive) */ int numCharCountBits(int ver) { assert QrCode.MIN_VERSION <= ver && ver <= QrCode.MAX_VERSION; diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index c1459c5..4f7a296 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -856,7 +856,8 @@ var qrcodegen = new function() { // (Package-private) The mode indicator bits, which is a uint4 value (range 0 to 15). Object.defineProperty(this, "modeBits", {value:mode}); - // (Package-private) Returns the bit width of the segment character count field for this mode object at the given version number. + // (Package-private) Returns the bit width of the character count field for a segment in + // this mode in a QR Code at the given version number. The result is in the range [0, 16]. this.numCharCountBits = function(ver) { return ccbits[Math.floor((ver + 7) / 17)]; }; diff --git a/python/qrcodegen.py b/python/qrcodegen.py index d2ca629..c4bc172 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -733,7 +733,7 @@ class QrSegment(object): # Private constructor def __init__(self, modebits, charcounts): self._modebits = modebits # The mode indicator bits, which is a uint4 value (range 0 to 15) - self._charcounts = charcounts # Three values for different version ranges + self._charcounts = charcounts # Number of character count bits for three different version ranges # Package-private method def get_mode_bits(self): @@ -742,7 +742,8 @@ class QrSegment(object): # Package-private method def num_char_count_bits(self, ver): - """Returns the bit width of the segment character count field for this mode object at the given version number.""" + """Returns the bit width of the character count field for a segment in this mode + in a QR Code at the given version number. The result is in the range [0, 16].""" return self._charcounts[(ver + 7) // 17] # Public constants. Create them outside the class. diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 90a0ecb..1db6288 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -1044,8 +1044,8 @@ impl QrSegmentMode { } - // Returns the bit width of the segment character count field - // for this mode object at the given version number. + // Returns the bit width of the character count field for a segment in this mode + // in a QR Code at the given version number. The result is in the range [0, 16]. pub fn num_char_count_bits(&self, ver: Version) -> u8 { use QrSegmentMode::*; (match *self { diff --git a/typescript/qrcodegen.ts b/typescript/qrcodegen.ts index 00c6da5..470324e 100644 --- a/typescript/qrcodegen.ts +++ b/typescript/qrcodegen.ts @@ -975,13 +975,14 @@ namespace qrcodegen.QrSegment { private constructor( // The mode indicator bits, which is a uint4 value (range 0 to 15). public readonly modeBits: int, - // Three values for different version ranges. + // Number of character count bits for three different version ranges. private readonly numBitsCharCount: [int,int,int]) {} /*-- Method --*/ - // (Package-private) Returns the bit width of the segment character count field for this mode object at the given version number. + // (Package-private) Returns the bit width of the character count field for a segment in + // this mode in a QR Code at the given version number. The result is in the range [0, 16]. public numCharCountBits(ver: int): int { return this.numBitsCharCount[Math.floor((ver + 7) / 17)]; }