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


Public Member Functions | |
| IntView ()=default | |
| IntView (const BitVector &v) | |
| Adopt an existing view as signed. | |
| int64_t | toI64 () const |
Convert to an int64_t, sign-extending from the high bit and throwing if the value does not fit. | |
| operator int64_t () const | |
| operator int32_t () const | |
| operator int16_t () const | |
| operator int8_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 | toInt () 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 a signed bit vector with toI64() and implicit conversions to signed scalar types.
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 |
| int64_t IntView::toI64 | ( | ) | const |
Convert to an int64_t, sign-extending from the high bit and throwing if the value does not fit.
Definition at line 538 of file Values.cpp.
References esi::BitVector::bitWidth, esi::BitVector::checkHighBytesEqual(), and esi::BitVector::getBit().
Referenced by operator int64_t(), and toInt().
|
inlineprivate |
Definition at line 258 of file Values.h.
References esi::BitVector::checkHighBytesEqual(), esi::BitVector::getBit(), toI64(), and esi::BitVector::width().