allows assigning to mask_view elements

This commit is contained in:
2025-03-03 20:33:23 +01:00
parent ae90adc854
commit 08280a094f
3 changed files with 41 additions and 49 deletions

View File

@@ -53,10 +53,20 @@ struct vtype_t {
bool vma();
bool vta();
};
class mask_bit_reference {
uint8_t* start;
uint8_t pos;
public:
mask_bit_reference& operator=(const bool new_value);
mask_bit_reference(uint8_t* start, uint8_t pos);
operator bool() const;
};
struct vmask_view {
uint8_t* start;
size_t elem_count;
bool operator[](size_t) const;
mask_bit_reference operator[](size_t) const;
};
enum class carry_t { NO_CARRY = 0, ADD_CARRY = 1, SUB_CARRY = 2 };
vmask_view read_vmask(uint8_t* V, uint16_t VLEN, uint16_t elem_count, uint8_t reg_idx = 0);