LLVM 22.0.0git
llvm::bitfields_details::Impl< Bitfield, StorageType > Struct Template Reference

Impl is where Bifield description and Storage are put together to interact with values. More...

#include "llvm/ADT/Bitfields.h"

Public Types

using IntegerType = typename Bitfield::IntegerType

Static Public Member Functions

static void checkValue (IntegerType UserValue, IntegerType UserMaxValue)
 Validates that UserValue fits within the bitfield's range.
static void update (StorageType &Packed, IntegerType UserValue)
 Checks UserValue is within bounds and packs it between FirstBit and LastBit of Packed leaving the rest unchanged.
static IntegerType extract (StorageType Packed)
 Interprets bits between FirstBit and LastBit of Packed as anIntegerType.
static StorageType test (StorageType Packed)
 Interprets bits between FirstBit and LastBit of Packed as anIntegerType.

Static Public Attributes

static constexpr size_t StorageBits = sizeof(StorageType) * CHAR_BIT
static constexpr StorageType LowMask
static constexpr StorageType Mask = LowMask << Bitfield::Shift

Detailed Description

template<typename Bitfield, typename StorageType>
struct llvm::bitfields_details::Impl< Bitfield, StorageType >

Impl is where Bifield description and Storage are put together to interact with values.

Definition at line 97 of file Bitfields.h.

Member Typedef Documentation

◆ IntegerType

template<typename Bitfield, typename StorageType>
using llvm::bitfields_details::Impl< Bitfield, StorageType >::IntegerType = typename Bitfield::IntegerType

Definition at line 100 of file Bitfields.h.

Member Function Documentation

◆ checkValue()

template<typename Bitfield, typename StorageType>
void llvm::bitfields_details::Impl< Bitfield, StorageType >::checkValue ( IntegerType UserValue,
IntegerType UserMaxValue )
inlinestatic

Validates that UserValue fits within the bitfield's range.

Definition at line 110 of file Bitfields.h.

References assert(), llvm::isInt(), and llvm::isUInt().

Referenced by update().

◆ extract()

template<typename Bitfield, typename StorageType>
IntegerType llvm::bitfields_details::Impl< Bitfield, StorageType >::extract ( StorageType Packed)
inlinestatic

Interprets bits between FirstBit and LastBit of Packed as anIntegerType.

Definition at line 132 of file Bitfields.h.

References Mask, and llvm::SignExtend64().

◆ test()

template<typename Bitfield, typename StorageType>
StorageType llvm::bitfields_details::Impl< Bitfield, StorageType >::test ( StorageType Packed)
inlinestatic

Interprets bits between FirstBit and LastBit of Packed as anIntegerType.

Definition at line 141 of file Bitfields.h.

References Mask.

◆ update()

template<typename Bitfield, typename StorageType>
void llvm::bitfields_details::Impl< Bitfield, StorageType >::update ( StorageType & Packed,
IntegerType UserValue )
inlinestatic

Checks UserValue is within bounds and packs it between FirstBit and LastBit of Packed leaving the rest unchanged.

Definition at line 123 of file Bitfields.h.

References checkValue(), LowMask, and Mask.

Member Data Documentation

◆ LowMask

template<typename Bitfield, typename StorageType>
StorageType llvm::bitfields_details::Impl< Bitfield, StorageType >::LowMask
staticconstexpr
Initial value:
=
constexpr T maskTrailingOnes(unsigned N)
Create a bitmask with the N right-most bits set to 1, and all other bits set to 0.
Definition MathExtras.h:77

Definition at line 105 of file Bitfields.h.

Referenced by update().

◆ Mask

template<typename Bitfield, typename StorageType>
StorageType llvm::bitfields_details::Impl< Bitfield, StorageType >::Mask = LowMask << Bitfield::Shift
staticconstexpr

Definition at line 107 of file Bitfields.h.

Referenced by extract(), test(), and update().

◆ StorageBits

template<typename Bitfield, typename StorageType>
size_t llvm::bitfields_details::Impl< Bitfield, StorageType >::StorageBits = sizeof(StorageType) * CHAR_BIT
staticconstexpr

Definition at line 102 of file Bitfields.h.


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