mirror of
https://github.com/opencv/opencv.git
synced 2024-12-12 15:19:11 +08:00
ef0fcb9238
Use reinterpret instead of c-style casting for GCC Co-authored-by: Xu Zhang <xu.zhang@hexintek.com> Co-authored-by: Maksim Shabunin <maksim.shabunin@gmail.com>
27 lines
596 B
C++
27 lines
596 B
C++
#include <stdio.h>
|
|
|
|
#if defined(__riscv)
|
|
# include <riscv_vector.h>
|
|
# define CV_RVV 1
|
|
#endif
|
|
|
|
#if defined CV_RVV
|
|
int test()
|
|
{
|
|
const float src[] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
|
uint64_t ptr[2] = {0x0908060504020100, 0xFFFFFFFF0E0D0C0A};
|
|
vuint8m1_t a = vreinterpret_v_u64m1_u8m1(vle64_v_u64m1(ptr, 2));
|
|
//vuint8m1_t a = (vuint8m1_t)vle64_v_u64m1(ptr, 2);
|
|
vfloat32m1_t val = vle32_v_f32m1((const float*)(src), 4);
|
|
return (int)vfmv_f_s_f32m1_f32(val);
|
|
}
|
|
#else
|
|
#error "RISC-V vector extension(RVV) is not supported"
|
|
#endif
|
|
|
|
int main()
|
|
{
|
|
printf("%d\n", test());
|
|
return 0;
|
|
}
|