Simplified QrSegment.Mode.numCharCountBits() in all language versions.

This commit is contained in:
Project Nayuki
2018-08-28 20:11:05 +00:00
parent 16b59e207d
commit 362d552c92
7 changed files with 9 additions and 39 deletions
+1 -4
View File
@@ -740,10 +740,7 @@ 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."""
if 1 <= ver <= 9: return self._charcounts[0]
elif 10 <= ver <= 26: return self._charcounts[1]
elif 27 <= ver <= 40: return self._charcounts[2]
else: raise ValueError("Version number out of range")
return self._charcounts[(ver + 7) // 17]
# Public constants. Create them outside the class.
Mode.NUMERIC = Mode(0x1, (10, 12, 14))