Mercurial > vec
comparison test/test.cc @ 17:41dd962abdd1
*: allow compiling vec in a C++ translation unit
this is stupid, but whatever
author | Paper <paper@tflc.us> |
---|---|
date | Wed, 20 Nov 2024 12:02:15 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
16:9da2aba90c87 | 17:41dd962abdd1 |
---|---|
1 #define VEC_IMPLEMENTATION | |
2 #include "vec/vec.h" | |
3 | |
4 #include <iostream> | |
5 | |
6 /* this test makes sure that vec can be included under C++ */ | |
7 int main(void) | |
8 { | |
9 int ret = 0; | |
10 | |
11 VUINT32x8_ALIGNED_ARRAY(varrin); | |
12 VUINT32x8_ALIGNED_ARRAY(varrout); | |
13 | |
14 for (int i = 0; i < 8; i++) | |
15 varrin[i] = i; | |
16 | |
17 vuint32x8 vec = vuint32x8_load_aligned(varrin); | |
18 vec = vuint32x8_add(vec, vec); | |
19 | |
20 vuint32x8_store_aligned(vec, varrout); | |
21 | |
22 for (int i = 0; i < 8; i++) | |
23 if (varrout[i] != (uint32_t)(varrin[i] + varrin[i])) | |
24 ret |= 1; | |
25 | |
26 return ret; | |
27 } |