| #ifndef SOFTRVV_VSEXT_VZEXT_H | |
| #define SOFTRVV_VSEXT_VZEXT_H | |
| #include <stddef.h> | |
| namespace softrvv { | |
| // Cast a vector from T2 to T1 | |
| // vsext is the vector signed extention instruction | |
| template <typename T1, typename T2> | |
| void vsext_v(T1 *dest, const T2 *src1, int32_t avl) { | |
| for (int32_t idx = 0; idx < avl; idx++) { | |
| dest[idx] = static_cast<T1>(src1[idx]); | |
| } | |
| } | |
| // Cast a vector from T2 to T1 | |
| // vzext is the vector zero extention instruction | |
| // Function is identical to vsext as compiler | |
| // does the right thing when T1,T2 are unsigned | |
| template <typename T1, typename T2> | |
| void vzext_v(T1 *dest, const T2 *src1, int32_t avl) { | |
| vsext_v<T1, T2>(dest, src1, avl); | |
| } | |
| } // namespace softrvv | |
| #endif // SOFTRVV_VSEXT_VZEXT_H |