small cleanup
This commit is contained in:
parent
528c2536af
commit
0264c5d66f
@ -42,23 +42,17 @@
|
|||||||
#ifndef _VM_VECTOR_FUNCTIONS_H_
|
#ifndef _VM_VECTOR_FUNCTIONS_H_
|
||||||
#error __FILE__ should only be included from vector_functions.h
|
#error __FILE__ should only be included from vector_functions.h
|
||||||
#endif
|
#endif
|
||||||
#include <boost/integer.hpp>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
namespace softvector {
|
namespace softvector {
|
||||||
|
|
||||||
template <typename elem_t> struct vreg_view {
|
template <typename elem_t> struct vreg_view {
|
||||||
uint8_t* start;
|
uint8_t* start;
|
||||||
size_t elem_count;
|
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) {
|
elem_t& operator[](size_t idx) {
|
||||||
assert(idx < elem_count);
|
assert(idx < elem_count);
|
||||||
return *(reinterpret_cast<elem_t*>(start) + idx);
|
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) {
|
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);
|
assert(V + elem_count * sizeof(elem_t) <= V + VLEN * RFS / 8);
|
||||||
return {V + VLEN / 8 * reg_idx, elem_count};
|
return {V + VLEN / 8 * reg_idx, elem_count};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user