Mercurial > vec
comparison test/test.c @ 37:4b5a557aa64f
*: turns out extern is a practical joke. rewrite to be always inline again
the sample benchmark performs about 3x as well with optimizations
disabled :)
| author | Paper <paper@tflc.us> |
|---|---|
| date | Sat, 26 Apr 2025 01:04:35 -0400 |
| parents | 641d8c79b1da |
| children | f9ca85d2f14c |
comparison
equal
deleted
inserted
replaced
| 36:677c03c382b8 | 37:4b5a557aa64f |
|---|---|
| 1 #include "vec/vec.h" | 1 #include "vec/vec.h" |
| 2 | 2 |
| 3 #include <stdio.h> | 3 #include <stdio.h> |
| 4 #include <string.h> | 4 #include <string.h> |
| 5 #include <inttypes.h> | 5 #include <inttypes.h> |
| 6 #include <time.h> | |
| 6 | 7 |
| 7 #define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0])) | 8 #define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0])) |
| 8 | 9 |
| 9 static const int8_t testval8[] = { | 10 static const int8_t testval8[] = { |
| 10 INT8_C(-80), INT8_C(-3), INT8_C(25), INT8_C(0x7F), | 11 INT8_C(-80), INT8_C(-3), INT8_C(25), INT8_C(0x7F), |
| 111 | 112 |
| 112 #include "test_align.h" | 113 #include "test_align.h" |
| 113 #include "test_arith.h" | 114 #include "test_arith.h" |
| 114 #include "test_compare.h" | 115 #include "test_compare.h" |
| 115 #include "test_shift.h" | 116 #include "test_shift.h" |
| 117 #include "test_benchmark.h" | |
| 116 | 118 |
| 117 // ------------------------------------------------------------ | 119 // ------------------------------------------------------------ |
| 118 | 120 |
| 119 int main(void) | 121 int main(void) |
| 120 { | 122 { |
| 121 int ret = 0; | 123 int ret = 0; |
| 122 | 124 |
| 123 vec_init(); | 125 srand(time(NULL)); |
| 124 | 126 |
| 125 ret |= test_align(); | 127 ret |= test_align(); |
| 126 ret |= test_arith(); | 128 ret |= test_arith(); |
| 127 ret |= test_compare(); | 129 ret |= test_compare(); |
| 128 ret |= test_shift(); | 130 ret |= test_shift(); |
| 129 | 131 |
| 132 test_benchmark(); | |
| 133 | |
| 130 return ret; | 134 return ret; |
| 131 } | 135 } |
