Blender V4.3
BLI_bit_ref.hh File Reference
#include "BLI_index_range.hh"
#include "BLI_utildefines.h"
#include <iosfwd>

Go to the source code of this file.

Classes

class  blender::bits::BitRef
 
class  blender::bits::MutableBitRef
 

Namespaces

namespace  blender
 
namespace  blender::bits
 

Typedefs

using blender::bits::BitInt = uint64_t
 

Functions

BitInt blender::bits::mask_first_n_bits (const int64_t n)
 
BitInt blender::bits::mask_last_n_bits (const int64_t n)
 
BitInt blender::bits::mask_range_bits (const int64_t start, const int64_t size)
 
BitInt blender::bits::mask_single_bit (const int64_t bit_index)
 
BitIntblender::bits::int_containing_bit (BitInt *data, const int64_t bit_index)
 
const BitIntblender::bits::int_containing_bit (const BitInt *data, const int64_t bit_index)
 
std::ostream & blender::bits::operator<< (std::ostream &stream, const BitRef &bit)
 
std::ostream & blender::bits::operator<< (std::ostream &stream, const MutableBitRef &bit)
 

Variables

static constexpr int64_t blender::bits::BitsPerInt = int64_t(sizeof(BitInt) * 8)
 
static constexpr int64_t blender::bits::BitToIntIndexShift
 
static constexpr BitInt blender::bits::BitIndexMask = (BitInt(1) << BitToIntIndexShift) - 1
 

Detailed Description

This file provides the basis for processing "indexed bits" (i.e. every bit has an index). The main purpose of this file is to define how bits are indexed within a memory buffer. For example, one has to define whether the first bit is the least or most significant bit and how endianness affect the bit order.

The order is defined as follows:

  • Every indexed bit is part of an #BitInt. These ints are ordered by their address as usual.
  • Within each #BitInt, the bits are ordered from least to most significant.

Definition in file BLI_bit_ref.hh.