MCPcopy
hub / github.com/zpao/qrcode.react / getNumRawDataModules

Method getNumRawDataModules

src/third-party/qrcodegen/index.ts:544–556  ·  view source on GitHub ↗
(ver: int)

Source from the content-addressed store, hash-verified

542 // all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
543 // The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
544 private static getNumRawDataModules(ver: int): int {
545 if (ver < QrCode.MIN_VERSION || ver > QrCode.MAX_VERSION)
546 throw new RangeError("Version number out of range");
547 let result: int = (16 * ver + 128) * ver + 64;
548 if (ver >= 2) {
549 const numAlign: int = Math.floor(ver / 7) + 2;
550 result -= (25 * numAlign - 10) * numAlign - 55;
551 if (ver >= 7)
552 result -= 36;
553 }
554 assert(208 <= result && result <= 29648);
555 return result;
556 }
557
558
559 // Returns the number of 8-bit data (i.e. not error correction) codewords contained in any

Callers 3

addEccAndInterleaveMethod · 0.80
drawCodewordsMethod · 0.80
getNumDataCodewordsMethod · 0.80

Calls 1

assertFunction · 0.85

Tested by

no test coverage detected