CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Loading...
Searching...
No Matches
Bitpack< StorageParam >::FieldInfo Struct Reference

Information about a field within a Bitpack. More...

#include <bitpack.hh>

Public Member Functions

bool operator== (const FieldInfo &) const =default
constexpr size_t width () const
 Return the field width, in bits.
constexpr Storage maximum_as_unsigned () const
 Return the maximum value this field can hold, if it is interpreted as holding an unsigned number.

Public Attributes

size_t minIndex
 Minimum 0-indexed bit position occupied by this field.
size_t maxIndex
 Maximum 0-indexed bit position occupied by this field.
bool isConst = false
 Should this field be proxied as constant (and so mutation be slightly less ergonomic)?

Detailed Description

template<typename StorageParam>
struct Bitpack< StorageParam >::FieldInfo

Information about a field within a Bitpack.

Fields are contiguous spans of bits and so have a lowest and highest bit position within the underlying Storage word.

Fields may be marked as constant to dissuade software from attempting to change their value. Do note, though, that any store of an underlying Storage word will also, necessarily, include the bits for constant Fields. It is likely generally more advisable to not mix constant and non-constant fields within the same Storage word or Bitpack.

Definition at line 461 of file bitpack.hh.

Member Function Documentation

◆ maximum_as_unsigned()

template<typename StorageParam>
Storage Bitpack< StorageParam >::FieldInfo::maximum_as_unsigned ( ) const
inlinenodiscardconstexpr

Return the maximum value this field can hold, if it is interpreted as holding an unsigned number.

Definition at line 485 of file bitpack.hh.

References width().

◆ width()

template<typename StorageParam>
size_t Bitpack< StorageParam >::FieldInfo::width ( ) const
inlinenodiscardconstexpr

Return the field width, in bits.

Definition at line 476 of file bitpack.hh.

References maxIndex, and minIndex.

Referenced by maximum_as_unsigned().

Member Data Documentation

◆ isConst

template<typename StorageParam>
bool Bitpack< StorageParam >::FieldInfo::isConst = false

Should this field be proxied as constant (and so mutation be slightly less ergonomic)?

Definition at line 471 of file bitpack.hh.

◆ maxIndex

template<typename StorageParam>
size_t Bitpack< StorageParam >::FieldInfo::maxIndex

Maximum 0-indexed bit position occupied by this field.

Definition at line 466 of file bitpack.hh.

Referenced by width().

◆ minIndex

template<typename StorageParam>
size_t Bitpack< StorageParam >::FieldInfo::minIndex

Minimum 0-indexed bit position occupied by this field.

Definition at line 464 of file bitpack.hh.

Referenced by width().


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