MCPcopy Create free account
hub / github.com/pingdotgg/t3code / getNumDataCodewords

Method getNumDataCodewords

packages/shared/src/qrCode.ts:569–575  ·  view source on GitHub ↗
(ver: int, ecl: QrCodeEcc)

Source from the content-addressed store, hash-verified

567 // QR Code of the given version number and error correction level, with remainder bits discarded.
568 // This stateless pure function could be implemented as a (40*4)-cell lookup table.
569 private static getNumDataCodewords(ver: int, ecl: QrCodeEcc): int {
570 return (
571 Math.floor(QrCode.getNumRawDataModules(ver) / 8) -
572 QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal]![ver]! *
573 QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal]![ver]!
574 );
575 }
576
577 // Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
578 // implemented as a lookup table over all possible parameter values, instead of as an algorithm.

Callers 2

encodeSegmentsMethod · 0.80
addEccAndInterleaveMethod · 0.80

Calls 1

getNumRawDataModulesMethod · 0.80

Tested by

no test coverage detected