MCPcopy Create free account
hub / github.com/Segs/Segs / uGetBits

Method uGetBits

Components/BitStream.cpp:274–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272 return tgt;
273}
274int32_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
290int32_t BitStream::GetPackedBits(uint32_t minbits)

Callers 2

ReceivedBlockMethod · 0.80
appendBitStreamMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected