Blender V5.0
blender::bits::BitSpan Class Reference

#include <BLI_bit_span.hh>

Inherited by blender::bits::BoundedBitSpan.

Public Member Functions

 BitSpan ()=default
 BitSpan (const BitInt *data, const int64_t size_in_bits)
 BitSpan (const BitInt *data, const IndexRange bit_range)
int64_t size () const
bool is_empty () const
IndexRange index_range () const
BitRef operator[] (const int64_t index) const
BitSpan slice (const IndexRange range) const
BitSpan take_front (const int64_t n) const
BitSpan take_back (const int64_t n) const
BitSpan drop_front (const int64_t n) const
BitSpan drop_back (const int64_t n) const
const BitIntdata () const
const IndexRangebit_range () const
BitIterator begin () const
BitIterator end () const

Protected Attributes

const BitIntdata_ = nullptr
IndexRange bit_range_ = {0, 0}

Detailed Description

Similar to Span, but references a range of bits instead of normal C++ types (which must be at least one byte large). Use MutableBitSpan if the values are supposed to be modified.

The beginning and end of a BitSpan does not have to be at byte/int boundaries. It can start and end at any bit.

Definition at line 72 of file BLI_bit_span.hh.

Constructor & Destructor Documentation

◆ BitSpan() [1/3]

◆ BitSpan() [2/3]

blender::bits::BitSpan::BitSpan ( const BitInt * data,
const int64_t size_in_bits )
inline

Definition at line 84 of file BLI_bit_span.hh.

References bit_range_, data(), and data_.

◆ BitSpan() [3/3]

blender::bits::BitSpan::BitSpan ( const BitInt * data,
const IndexRange bit_range )
inline

Definition at line 88 of file BLI_bit_span.hh.

References bit_range(), bit_range_, data(), and data_.

Member Function Documentation

◆ begin()

Definition at line 148 of file BLI_bit_span.hh.

References bit_range_, and data_.

◆ bit_range()

◆ data()

◆ drop_back()

Definition at line 133 of file BLI_bit_span.hh.

References bit_range_, BitSpan(), and data_.

◆ drop_front()

Definition at line 128 of file BLI_bit_span.hh.

References bit_range_, BitSpan(), and data_.

◆ end()

Definition at line 153 of file BLI_bit_span.hh.

References bit_range_, and data_.

◆ index_range()

Definition at line 101 of file BLI_bit_span.hh.

References bit_range_.

Referenced by blender::bits::tests::TEST().

◆ is_empty()

◆ operator[]()

BitRef blender::bits::BitSpan::operator[] ( const int64_t index) const
inlinenodiscard

Definition at line 106 of file BLI_bit_span.hh.

References bit_range_, BLI_assert, and data_.

◆ size()

◆ slice()

BitSpan blender::bits::BitSpan::slice ( const IndexRange range) const
inlinenodiscard

Definition at line 113 of file BLI_bit_span.hh.

References bit_range_, BitSpan(), and data_.

Referenced by blender::bits::tests::TEST().

◆ take_back()

Definition at line 123 of file BLI_bit_span.hh.

References bit_range_, BitSpan(), and data_.

◆ take_front()

Definition at line 118 of file BLI_bit_span.hh.

References bit_range_, BitSpan(), and data_.

Member Data Documentation

◆ bit_range_

◆ data_

Base pointer to the integers containing the bits. The actual bit span might start at a much higher address when bit_range_.start() is large.

Definition at line 76 of file BLI_bit_span.hh.

Referenced by begin(), BitSpan(), BitSpan(), data(), drop_back(), drop_front(), end(), operator[](), slice(), take_back(), take_front(), and blender::bits::BoundedBitSpan::take_front().


The documentation for this class was generated from the following file: