=========================================================================== * Reverse the first len bits of a code, using straightforward code (a faster * method would use a table) * IN assertion: 1 <= len <= 15 */
| 1089 | * IN assertion: 1 <= len <= 15 |
| 1090 | */ |
| 1091 | local unsigned bi_reverse(unsigned code, int len) |
| 1092 | { |
| 1093 | register unsigned res = 0; |
| 1094 | do { |
| 1095 | res |= code & 1; |
| 1096 | code >>= 1, res <<= 1; |
| 1097 | } while (--len > 0); |
| 1098 | return res >> 1; |
| 1099 | } |
| 1100 | |
| 1101 | /* =========================================================================== |
| 1102 | * Flush the bit buffer, keeping at most 7 bits in it. |
no outgoing calls
no test coverage detected