| 272 | return tgt; |
| 273 | } |
| 274 | int32_t BitStream::uGetBits(uint32_t nBits) |
| 275 | { |
| 276 | assert((nBits>0) && nBits<= BITS_PER_UINT32); |
| 277 | assert(GetReadableBits()>=nBits); |
| 278 | assert(m_read_off+7<(m_size+m_safe_area)); |
| 279 | nBits = ((nBits-1) &0x1F)+1; // make sure the nBits range is 1-32 |
| 280 | uint64_t *tp = reinterpret_cast<uint64_t *>(read_ptr()); |
| 281 | uint64_t r = *tp; |
| 282 | r>>=m_read_bit_off; // starting at the top |
| 283 | int32_t tgt = int32_t(r & (~1ull)>>(64-nBits)); |
| 284 | read_ptr((m_read_bit_off+nBits)>>3); |
| 285 | m_read_bit_off = (m_read_bit_off+nBits)&0x7; |
| 286 | return tgt; |
| 287 | } |
| 288 | |
| 289 | |
| 290 | int32_t BitStream::GetPackedBits(uint32_t minbits) |
no outgoing calls
no test coverage detected