MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / mirror

Function mirror

Source/Amiga/dernc.cpp:331–342  ·  view source on GitHub ↗

* Mirror the bottom n bits of x. */

Source from the content-addressed store, hash-verified

329 * Mirror the bottom n bits of x.
330 */
331static unsigned long mirror (unsigned long x, int n) {
332 unsigned long top = 1 << (n-1), bottom = 1;
333 while (top > bottom) {
334 unsigned long mask = top | bottom;
335 unsigned long masked = x & mask;
336 if (masked != 0 && masked != mask)
337 x ^= mask;
338 top >>= 1;
339 bottom <<= 1;
340 }
341 return x;
342}
343
344/*
345 * Calculate a CRC, the RNC way. It re-computes its CRC table every

Callers 1

read_huftableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected