|
CIRCT 22.0.0git
|
A mutable bit vector that owns its underlying storage. More...
#include <Values.h>


Public Member Functions | |
| MutableBitVector (size_t width) | |
| Owning, zero-initialized constructor of a given width. | |
| MutableBitVector (std::vector< byte > &&bytes, std::optional< size_t > width=std::nullopt) | |
| Owning constructor from an rvalue vector (must move in). | |
| MutableBitVector ()=default | |
| MutableBitVector (const MutableBitVector &other) | |
| MutableBitVector (const BitVector &other) | |
| MutableBitVector (MutableBitVector &&other) noexcept | |
| MutableBitVector (BitVector &&other) | |
| MutableBitVector & | operator= (const MutableBitVector &other) |
| MutableBitVector & | operator= (MutableBitVector &&other) noexcept |
| void | setBit (size_t i, bool v) |
| Set the i-th bit. | |
| std::span< const byte > | getSpan () const |
| Return a handle to the underlying span (always aligned since bitIndex=0). | |
| std::vector< uint8_t > | takeStorage () |
| Return and transfer ownership of the underlying storage. | |
| MutableBitVector & | operator>>= (size_t n) |
| In-place logical right shift that drops the least-significant n bits. | |
| MutableBitVector & | operator<<= (size_t n) |
| In-place logical left shift shifts in n zero bits at LSB, shifting existing bits upward. | |
| MutableBitVector & | operator<<= (const MutableBitVector &other) |
| In-place concatenate: appends bits from other to this. | |
| MutableBitVector & | operator|= (const MutableBitVector &other) |
| MutableBitVector & | operator&= (const MutableBitVector &other) |
| MutableBitVector & | operator^= (const MutableBitVector &other) |
| MutableBitVector | operator~ () const |
| MutableBitVector | operator| (const MutableBitVector &other) const |
| MutableBitVector | operator& (const MutableBitVector &other) const |
| MutableBitVector | operator^ (const MutableBitVector &other) const |
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 Attributes | |
| std::vector< byte > | owner |
Additional Inherited Members | |
Public Types inherited from esi::BitVector | |
| using | byte = uint8_t |
Protected Attributes inherited from esi::BitVector | |
| std::span< const byte > | data {} |
| size_t | bitWidth = 0 |
| uint8_t | bitIndex = 0 |
A mutable bit vector that owns its underlying storage.
It supports in-place modifications and mutable operations.
|
explicit |
Owning, zero-initialized constructor of a given width.
Definition at line 99 of file Values.cpp.
References esi::BitVector::bitIndex, esi::BitVector::bitWidth, esi::BitVector::data, owner, and esi::BitVector::width().
| MutableBitVector::MutableBitVector | ( | std::vector< byte > && | bytes, |
| std::optional< size_t > | width = std::nullopt |
||
| ) |
Owning constructor from an rvalue vector (must move in).
Definition at line 105 of file Values.cpp.
References esi::BitVector::bitIndex, esi::BitVector::bitWidth, esi::BitVector::data, owner, and esi::BitVector::width().
|
default |
| MutableBitVector::MutableBitVector | ( | const MutableBitVector & | other | ) |
Definition at line 115 of file Values.cpp.
References esi::BitVector::bitIndex, esi::BitVector::bitWidth, esi::BitVector::data, and owner.
| MutableBitVector::MutableBitVector | ( | const BitVector & | other | ) |
Definition at line 122 of file Values.cpp.
References esi::BitVector::bitIndex, esi::BitVector::bitWidth, esi::BitVector::data, esi::BitVector::getBit(), owner, setBit(), and esi::BitVector::width().
|
noexcept |
Definition at line 144 of file Values.cpp.
References esi::BitVector::bitWidth.
| MutableBitVector::MutableBitVector | ( | BitVector && | other | ) |
Definition at line 133 of file Values.cpp.
References esi::BitVector::bitIndex, esi::BitVector::bitWidth, esi::BitVector::data, owner, setBit(), and esi::BitVector::width().
|
inline |
Return a handle to the underlying span (always aligned since bitIndex=0).
Definition at line 216 of file Values.h.
References esi::BitVector::data.
| MutableBitVector MutableBitVector::operator& | ( | const MutableBitVector & | other | ) | const |
Definition at line 485 of file Values.cpp.
| MutableBitVector & MutableBitVector::operator&= | ( | const MutableBitVector & | other | ) |
Definition at line 448 of file Values.cpp.
References esi::BitVector::bitWidth, esi::BitVector::getBit(), and setBit().
| MutableBitVector & MutableBitVector::operator<<= | ( | const MutableBitVector & | other | ) |
In-place concatenate: appends bits from other to this.
Definition at line 233 of file Values.cpp.
References esi::BitVector::bitIndex, esi::BitVector::bitWidth, esi::BitVector::data, esi::BitVector::getBit(), owner, and esi::BitVector::width().
| MutableBitVector & MutableBitVector::operator<<= | ( | size_t | n | ) |
In-place logical left shift shifts in n zero bits at LSB, shifting existing bits upward.
Definition at line 211 of file Values.cpp.
References esi::BitVector::bitIndex, esi::BitVector::bitWidth, esi::BitVector::data, esi::BitVector::getBit(), and owner.
| MutableBitVector & MutableBitVector::operator= | ( | const MutableBitVector & | other | ) |
Definition at line 154 of file Values.cpp.
References esi::BitVector::bitIndex, esi::BitVector::bitWidth, esi::BitVector::data, and owner.
|
noexcept |
Definition at line 165 of file Values.cpp.
| MutableBitVector & MutableBitVector::operator>>= | ( | size_t | n | ) |
In-place logical right shift that drops the least-significant n bits.
Reduces width and updates internal state. Does not modify underlying storage.
Definition at line 191 of file Values.cpp.
| MutableBitVector MutableBitVector::operator^ | ( | const MutableBitVector & | other | ) | const |
Definition at line 492 of file Values.cpp.
| MutableBitVector & MutableBitVector::operator^= | ( | const MutableBitVector & | other | ) |
Definition at line 464 of file Values.cpp.
References esi::BitVector::bitWidth, esi::BitVector::getBit(), and setBit().
| MutableBitVector MutableBitVector::operator| | ( | const MutableBitVector & | other | ) | const |
Definition at line 478 of file Values.cpp.
| MutableBitVector & MutableBitVector::operator|= | ( | const MutableBitVector & | other | ) |
Definition at line 456 of file Values.cpp.
References esi::BitVector::bitWidth, esi::BitVector::getBit(), and setBit().
| MutableBitVector MutableBitVector::operator~ | ( | ) | const |
Definition at line 471 of file Values.cpp.
References esi::BitVector::bitWidth, esi::BitVector::getBit(), and setBit().
| void MutableBitVector::setBit | ( | size_t | i, |
| bool | v | ||
| ) |
Set the i-th bit.
Definition at line 178 of file Values.cpp.
References esi::BitVector::bitWidth, and owner.
Referenced by esi::Int::Int(), MutableBitVector(), MutableBitVector(), operator&=(), operator^=(), operator|=(), operator~(), and esi::UInt::UInt().
|
inline |
Return and transfer ownership of the underlying storage.
Definition at line 219 of file Values.h.
References owner.
Referenced by esi::BitsType::deserialize().
|
private |
Definition at line 243 of file Values.h.
Referenced by MutableBitVector(), MutableBitVector(), MutableBitVector(), MutableBitVector(), MutableBitVector(), operator<<=(), operator<<=(), operator=(), setBit(), and takeStorage().