MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / bb_invertBit

Function bb_invertBit

Libraries/QRCode/src/qrcode.c:233–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231}
232
233static void bb_invertBit(BitBucket *bitGrid, uint8_t x, uint8_t y, bool invert) {
234 uint32_t offset = y * bitGrid->bitOffsetOrWidth + x;
235 uint8_t mask = 1 << (7 - (offset & 0x07));
236 bool on = ((bitGrid->data[offset >> 3] & (1 << (7 - (offset & 0x07)))) != 0);
237 if (on ^ invert) {
238 bitGrid->data[offset >> 3] |= mask;
239 } else {
240 bitGrid->data[offset >> 3] &= ~mask;
241 }
242}
243
244static bool bb_getBit(BitBucket *bitGrid, uint8_t x, uint8_t y) {
245 uint32_t offset = y * bitGrid->bitOffsetOrWidth + x;

Callers 1

applyMaskFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected