#ifndef SOFTRVV_VNSRL_H
#define SOFTRVV_VNSRL_H

#include <stddef.h>

#include <type_traits>

namespace softrvv {

template <typename T1, typename T2>
void vnsrl_vx(T1 *dest, T2 *src1, const T1 *src2, int32_t avl) {
  // Only low lg2(SEW*2) bits are used for shift
  static_assert(sizeof(T1) * 2 == sizeof(T2));
  const T1 low_bits_mask = sizeof(T2) * 8 - 1;
  const T1 shift = *src2 & low_bits_mask;
  for (int32_t idx = 0; idx < avl; idx++) {
    dest[idx] = static_cast<T1>(
        static_cast<typename std::make_unsigned<T2>::type>(src1[idx]) >> shift);
  }
}

template <typename T1, typename T2>
void vnsrl_vv(T1 *dest, T2 *src1, T1 *src2, int32_t avl) {
  // // Only low lg2(SEW*2) bits are used for shift
  static_assert(sizeof(T1) * 2 == sizeof(T2));
  const T1 low_bits_mask = sizeof(T2) * 8 - 1;
  for (int32_t idx = 0; idx < avl; idx++) {
    dest[idx] = static_cast<T1>(
        static_cast<typename std::make_unsigned<T2>::type>(src1[idx])
        >> (src2[idx] & low_bits_mask));
  }
}

}  // namespace softrvv

#endif  // SOFTRVV_VNSRL_H
