MCPcopy Create free account
hub / github.com/DFHack/dfhack / writeBits

Function writeBits

depends/lodepng/lodepng.cpp:432–442  ·  view source on GitHub ↗

LSB of value is written first, and LSB of bytes is used first */

Source from the content-addressed store, hash-verified

430
431/* LSB of value is written first, and LSB of bytes is used first */
432static void writeBits(LodePNGBitWriter* writer, unsigned value, size_t nbits) {
433 if(nbits == 1) { /* compiler should statically compile this case if nbits == 1 */
434 WRITEBIT(writer, value);
435 } else {
436 /* TODO: increase output size only once here rather than in each WRITEBIT */
437 size_t i;
438 for(i = 0; i != nbits; ++i) {
439 WRITEBIT(writer, (unsigned char)((value >> i) & 1));
440 }
441 }
442}
443
444/* This one is to use for adding huffman symbol, the value bits are written MSB first */
445static void writeBitsReversed(LodePNGBitWriter* writer, unsigned value, size_t nbits) {

Callers 3

writeLZ77dataFunction · 0.85
deflateDynamicFunction · 0.85
deflateFixedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected