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

Function getModule

modules/data/qrcode/qrcodegen.c:657–664  ·  view source on GitHub ↗

Gets the module at the given coordinates, which must be in bounds.

Source from the content-addressed store, hash-verified

655
656// Gets the module at the given coordinates, which must be in bounds.
657testable bool getModule(const uint8_t qrcode[], int x, int y) {
658 int qrsize = qrcode[0];
659 assert(21 <= qrsize && qrsize <= 177 && 0 <= x && x < qrsize && 0 <= y && y < qrsize);
660 int index = y * qrsize + x;
661 int bitIndex = index & 7;
662 int byteIndex = (index >> 3) + 1;
663 return ((qrcode[byteIndex] >> bitIndex) & 1) != 0;
664}
665
666
667// Sets the module at the given coordinates, which must be in bounds.

Callers 4

drawCodewordsFunction · 0.85
applyMaskFunction · 0.85
getPenaltyScoreFunction · 0.85
qrcodegen_getModuleFunction · 0.85

Calls 1

assertFunction · 0.50

Tested by

no test coverage detected