=========================================================================== * Reverse the first len bits of a code, using straightforward code (a faster * method would use a table) * IN assertion: 1 <= len <= 15 */
(code, len)
| 1156 | * IN assertion: 1 <= len <= 15 |
| 1157 | */ |
| 1158 | local unsigned bi_reverse(code, len) |
| 1159 | unsigned code; /* the value to invert */ |
| 1160 | int len; /* its bit length */ |
| 1161 | { |
| 1162 | register unsigned res = 0; |
| 1163 | do { |
| 1164 | res |= code & 1; |
| 1165 | code >>= 1, res <<= 1; |
| 1166 | } while (--len > 0); |
| 1167 | return res >> 1; |
| 1168 | } |
| 1169 | |
| 1170 | /* =========================================================================== |
| 1171 | * Flush the bit buffer, keeping at most 7 bits in it. |
no outgoing calls
no test coverage detected