=========================================================================== * 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)
| 1243 | * IN assertion: 1 <= len <= 15 |
| 1244 | */ |
| 1245 | local unsigned bi_reverse(code, len) |
| 1246 | unsigned code; /* the value to invert */ |
| 1247 | int len; /* its bit length */ |
| 1248 | { |
| 1249 | register unsigned res = 0; |
| 1250 | do |
| 1251 | { |
| 1252 | res |= code & 1; |
| 1253 | code >>= 1 , res <<= 1; |
| 1254 | } |
| 1255 | while (--len > 0); |
| 1256 | return res >> 1; |
| 1257 | } |
| 1258 | |
| 1259 | /* =========================================================================== |
| 1260 | * Flush the bit buffer, keeping at most 7 bits in it. |
no outgoing calls
no test coverage detected