=========================================================================== * 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)
| 1144 | * IN assertion: 1 <= len <= 15 |
| 1145 | */ |
| 1146 | local unsigned bi_reverse(code, len) |
| 1147 | unsigned code; /* the value to invert */ |
| 1148 | int len; /* its bit length */ |
| 1149 | { |
| 1150 | register unsigned res = 0; |
| 1151 | do { |
| 1152 | res |= code & 1; |
| 1153 | code >>= 1, res <<= 1; |
| 1154 | } while (--len > 0); |
| 1155 | return res >> 1; |
| 1156 | } |
| 1157 | |
| 1158 | /* =========================================================================== |
| 1159 | * Flush the bit buffer, keeping at most 7 bits in it. |
no outgoing calls
no test coverage detected