* @brief Decode the next value from a bit stream * * This method takes the next value from the bit stream decoding the bits with * the code tree currently loaded. */
| 181 | * the code tree currently loaded. |
| 182 | */ |
| 183 | unsigned short decode (BitStream &s) const |
| 184 | { |
| 185 | tl_assert (mp_codes != 0); |
| 186 | |
| 187 | unsigned int m = m_num_codes / 2; |
| 188 | |
| 189 | unsigned int c = 0; |
| 190 | do { |
| 191 | if (s.get_bit ()) { |
| 192 | c |= m; |
| 193 | } |
| 194 | m >>= 1; |
| 195 | } while ((mp_bitmasks [c] & m) != 0); |
| 196 | |
| 197 | return mp_codes [c]; |
| 198 | } |
| 199 | |
| 200 | private: |
| 201 | unsigned short *mp_codes, *mp_bitmasks; |
no outgoing calls
no test coverage detected