MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / bi_reverse

Function bi_reverse

extern/zlib/src/trees.c:154–161  ·  view source on GitHub ↗

=========================================================================== * Reverse the first len bits of a code, using straightforward code (a faster * method would use a table) * IN assertion: 1 <= len <= 15 */

Source from the content-addressed store, hash-verified

152 * IN assertion: 1 <= len <= 15
153 */
154local unsigned bi_reverse(unsigned code, int len) {
155 register unsigned res = 0;
156 do {
157 res |= code & 1;
158 code >>= 1, res <<= 1;
159 } while (--len > 0);
160 return res >> 1;
161}
162
163/* ===========================================================================
164 * Flush the bit buffer, keeping at most 7 bits in it.

Callers 2

gen_codesFunction · 0.85
tr_static_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected