CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Loading...
Searching...
No Matches
Bitpack< StorageParam >::Field< TypeParam, InfoParam > Struct Template Reference

A particular Field within a Bitpack. More...

#include <bitpack.hh>

Collaboration diagram for Bitpack< StorageParam >::Field< TypeParam, InfoParam >:

Classes

class  Proxy
 A proxy for this Field within the Bitpack's Storage. More...

Public Types

using Type = TypeParam
 Expose the type parameter.
template<bool C, typename T>
using ConditionalConstRef

Public Member Functions

template<typename BitpackType>
 Proxy (BitpackType &r) -> Proxy< std::remove_cvref_t< BitpackType >, ConditionalConstRef< Info.isConst, decltype((r.value))> >

Static Public Member Functions

static constexpr Type raw_view (Storage storage)
 Extract a Field from a raw Storage value.
static constexpr Storage raw_with (Storage lhs, Storage rhs)
 Compute the underlying Storage transform for a Field update.
static constexpr Storage raw_with (Storage lhs, Type rhs)
 Update for fields whose type can be static_cast to Storage.
template<typename OtherStorage>
requires requires { sizeof(OtherStorage) < sizeof(Storage); }
static constexpr Storage raw_with (Storage lhs, Bitpack< OtherStorage > rhs)
 Update for fields that are themselves Bitpacks at smaller types.

Static Public Attributes

static constexpr FieldInfo Info = InfoParam
 Expose the FieldInfo parameter.
static constexpr Storage ValueMask
 A span of set bits, starting at index 0, and of the field's width.
static constexpr Storage FieldMask = ValueMask << Info.minIndex
 The mask of bits occupied by this value (occupied bits are set).

Detailed Description

template<typename StorageParam>
template<typename TypeParam, FieldInfo InfoParam>
struct Bitpack< StorageParam >::Field< TypeParam, InfoParam >

A particular Field within a Bitpack.

Fields are templated on the type as seen by external code and the FieldInfo data giving the field's location and other properties.

Definition at line 483 of file bitpack.hh.

Member Typedef Documentation

◆ ConditionalConstRef

template<typename StorageParam>
template<typename TypeParam, FieldInfo InfoParam>
template<bool C, typename T>
using Bitpack< StorageParam >::Field< TypeParam, InfoParam >::ConditionalConstRef
Initial value:
std::
conditional_t<C, std::add_const_t<std::remove_reference_t<T>> &, T>

Definition at line 785 of file bitpack.hh.

◆ Type

template<typename StorageParam>
template<typename TypeParam, FieldInfo InfoParam>
using Bitpack< StorageParam >::Field< TypeParam, InfoParam >::Type = TypeParam

Expose the type parameter.

Definition at line 486 of file bitpack.hh.

Member Function Documentation

◆ raw_view()

◆ raw_with() [1/3]

template<typename StorageParam>
template<typename TypeParam, FieldInfo InfoParam>
template<typename OtherStorage>
requires requires { sizeof(OtherStorage) < sizeof(Storage); }
constexpr Storage Bitpack< StorageParam >::Field< TypeParam, InfoParam >::raw_with ( Storage lhs,
Bitpack< OtherStorage > rhs )
inlinestaticconstexpr

Update for fields that are themselves Bitpacks at smaller types.

Definition at line 543 of file bitpack.hh.

References Bitpack< StorageParam >::Bitpack(), and raw_with().

◆ raw_with() [2/3]

◆ raw_with() [3/3]

template<typename StorageParam>
template<typename TypeParam, FieldInfo InfoParam>
constexpr Storage Bitpack< StorageParam >::Field< TypeParam, InfoParam >::raw_with ( Storage lhs,
Type rhs )
inlinestaticconstexpr

Update for fields whose type can be static_cast to Storage.

Definition at line 534 of file bitpack.hh.

Member Data Documentation

◆ FieldMask

template<typename StorageParam>
template<typename TypeParam, FieldInfo InfoParam>
Storage Bitpack< StorageParam >::Field< TypeParam, InfoParam >::FieldMask = ValueMask << Info.minIndex
staticconstexpr

The mask of bits occupied by this value (occupied bits are set).

Definition at line 519 of file bitpack.hh.

Referenced by raw_with().

◆ Info

template<typename StorageParam>
template<typename TypeParam, FieldInfo InfoParam>
FieldInfo Bitpack< StorageParam >::Field< TypeParam, InfoParam >::Info = InfoParam
staticconstexpr

Expose the FieldInfo parameter.

Definition at line 488 of file bitpack.hh.

Referenced by raw_view(), and raw_with().

◆ ValueMask

template<typename StorageParam>
template<typename TypeParam, FieldInfo InfoParam>
Storage Bitpack< StorageParam >::Field< TypeParam, InfoParam >::ValueMask
staticconstexpr
Initial value:
=
(1U << (Info.maxIndex - Info.minIndex + 1)) - 1
static constexpr FieldInfo Info
Expose the FieldInfo parameter.
Definition bitpack.hh:488

A span of set bits, starting at index 0, and of the field's width.

Definition at line 515 of file bitpack.hh.

Referenced by raw_view(), and raw_with().


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