|
CIRCT 23.0.0git
|
Non-owning view of an unsigned bit vector with toUI64() and implicit conversions to unsigned scalar types.
More...
#include <Values.h>


Public Member Functions | |
| UIntView ()=default | |
| UIntView (const BitVector &v) | |
| Adopt an existing view as unsigned. | |
| uint64_t | toUI64 () const |
Convert to a uint64_t, throwing if the value does not fit. | |
| operator uint64_t () const | |
| operator uint32_t () const | |
| operator uint16_t () const | |
| operator uint8_t () const | |
| BitVector (std::span< const byte > bytes, std::optional< size_t > width=std::nullopt, uint8_t bitIndex=0) | |
| Construct from an existing span. | |
| BitVector ()=default | |
| BitVector (const BitVector &other) | |
Public Member Functions inherited from esi::BitVector | |
| BitVector (std::span< const byte > bytes, std::optional< size_t > width=std::nullopt, uint8_t bitIndex=0) | |
| Construct from an existing span. | |
| BitVector ()=default | |
| BitVector (const BitVector &other) | |
| BitVector & | operator= (const BitVector &other) |
| size_t | width () const |
| size_t | size () const |
| bool | getBit (size_t i) const |
| Return the i-th bit (0 = LSB) as boolean. | |
| std::span< const byte > | getSpan () const |
| Return a handle to the underlying span. | |
| BitVector | operator>> (size_t n) const |
| Logical right shift that drops the least-significant n bits by advancing the byte/bit index and reducing width. | |
| BitVector & | operator>>= (size_t n) |
| BitVector | slice (size_t offset, size_t sliceWidth) const |
| Create a new immutable view of a contiguous bit slice [offset, offset+sliceWidth). | |
| BitVector | lsb (size_t n) const |
| Return a view of the N least-significant bits. | |
| BitVector | msb (size_t n) const |
| Return a view of the N most-significant bits. | |
| std::string | toString (unsigned base=16) const |
| bool | operator== (const BitVector &rhs) const |
| bool | operator!= (const BitVector &rhs) const |
| bit_iterator | begin () const |
| Return an iterator to the first bit (LSB). | |
| bit_iterator | end () const |
| Return an iterator past the last bit. | |
Private Member Functions | |
| template<typename T > | |
| T | toUInt () const |
Additional Inherited Members | |
Public Types inherited from esi::BitVector | |
| using | byte = uint8_t |
Protected Member Functions inherited from esi::BitVector | |
| void | checkHighBytesEqual (unsigned lowExclusive, uint8_t expectedByte, const char *fmt, unsigned target) const |
Protected Attributes inherited from esi::BitVector | |
| std::span< const byte > | data {} |
| size_t | bitWidth = 0 |
| uint8_t | bitIndex = 0 |
Non-owning view of an unsigned bit vector with toUI64() and implicit conversions to unsigned scalar types.
Adds only static-type tagging and conversion methods on top of BitVector. See the lifetime note on BitVector.
|
default |
|
inline |
|
default |
| BitVector::BitVector | ( | const BitVector & | other | ) |
Definition at line 60 of file Values.cpp.
| BitVector::BitVector | ( | std::span< const byte > | bytes, |
| std::optional< size_t > | width = std::nullopt, |
||
| uint8_t | bitIndex = 0 |
||
| ) |
Construct from an existing span.
Width defaults to the number of bits in the span (size * 8). The BitVector does not take ownership.
Definition at line 57 of file Values.cpp.
|
inline |
| uint64_t UIntView::toUI64 | ( | ) | const |
Convert to a uint64_t, throwing if the value does not fit.
Definition at line 566 of file Values.cpp.
References esi::BitVector::bitWidth, esi::BitVector::checkHighBytesEqual(), and esi::BitVector::getBit().
Referenced by operator uint64_t(), and toUInt().
|
inlineprivate |
Definition at line 222 of file Values.h.
References esi::BitVector::checkHighBytesEqual(), toUI64(), and esi::BitVector::width().