mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-12 13:59:46 -04:00
chore(ricepp): add comment to bitstream_reader
This commit is contained in:
parent
3109827ac2
commit
336cce52bf
@ -121,6 +121,12 @@ class bitstream_reader final {
|
||||
if (bit_pos_ == 0) [[unlikely]] {
|
||||
data_ = read_packet();
|
||||
}
|
||||
// The remainder of this function is equivalent to:
|
||||
//
|
||||
// return _bextr_u64(data_, bit_pos_, num_bits);
|
||||
//
|
||||
// However, in practice, at least clang generates code that is as fast
|
||||
// as the intrinsic, so we use the following code for portability.
|
||||
bits_type bits = data_ >> bit_pos_;
|
||||
if (num_bits < kBitsTypeBits) [[likely]] {
|
||||
bits &= (static_cast<bits_type>(1) << num_bits) - 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user