MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / getNumDataCodewords

Function getNumDataCodewords

modules/data/qrcode/qrcodegen.c:239–243  ·  view source on GitHub ↗

Returns the number of 8-bit codewords that can be used for storing data (not ECC), for the given version number and error correction level. The result is in the range [9, 2956].

Source from the content-addressed store, hash-verified

237// Returns the number of 8-bit codewords that can be used for storing data (not ECC),
238// for the given version number and error correction level. The result is in the range [9, 2956].
239testable int getNumDataCodewords(int version, enum qrcodegen_Ecc ecl) {
240 int v = version, e = (int)ecl;
241 assert(0 <= e && e < 4 && qrcodegen_VERSION_MIN <= v && v <= qrcodegen_VERSION_MAX);
242 return getNumRawDataModules(v) / 8 - c_read8(&ECC_CODEWORDS_PER_BLOCK[e][v]) * c_read8(&NUM_ERROR_CORRECTION_BLOCKS[e][v]);
243}
244
245
246// Returns the number of data bits that can be stored in a QR Code of the given version number, after

Callers 1

Calls 2

getNumRawDataModulesFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected