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

Function appendBitsToBuffer

modules/data/qrcode/qrcodegen.c:184–188  ·  view source on GitHub ↗

Appends the given sequence of bits to the given byte-based bit buffer, increasing the bit length.

Source from the content-addressed store, hash-verified

182
183// Appends the given sequence of bits to the given byte-based bit buffer, increasing the bit length.
184testable void appendBitsToBuffer(unsigned int val, int numBits, uint8_t buffer[], int *bitLen) {
185 assert(0 <= numBits && numBits <= 16 && (unsigned long)val >> numBits == 0);
186 for (int i = numBits - 1; i >= 0; i--, (*bitLen)++)
187 buffer[*bitLen >> 3] |= ((val >> i) & 1) << (7 - (*bitLen & 7));
188}
189
190
191

Callers 4

qrcodegen_makeNumericFunction · 0.85
qrcodegen_makeEciFunction · 0.85

Calls 1

assertFunction · 0.50

Tested by

no test coverage detected