small cleanup

This commit is contained in:
Eyck-Alexander Jentzsch 2025-02-25 15:14:48 +01:00
parent 528c2536af
commit 0264c5d66f

View File

@ -42,23 +42,17 @@
#ifndef _VM_VECTOR_FUNCTIONS_H_
#error __FILE__ should only be included from vector_functions.h
#endif
#include <boost/integer.hpp>
#include <math.h>
namespace softvector {
template <typename elem_t> struct vreg_view {
uint8_t* start;
size_t elem_count;
inline elem_t& get(size_t idx = 0) {
assert(idx < elem_count);
return *(reinterpret_cast<elem_t*>(start) + idx);
}
elem_t& operator[](size_t idx) {
assert(idx < elem_count);
return *(reinterpret_cast<elem_t*>(start) + idx);
}
};
// TODO: change the order of parameters so that it is in snyc with read_vmask
template <unsigned VLEN, typename elem_t> vreg_view<elem_t> get_vreg(uint8_t* V, uint8_t reg_idx, uint16_t elem_count) {
assert(V + elem_count * sizeof(elem_t) <= V + VLEN * RFS / 8);
return {V + VLEN / 8 * reg_idx, elem_count};