-
Notifications
You must be signed in to change notification settings - Fork 0
/
workbench.hpp
33 lines (25 loc) · 756 Bytes
/
workbench.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef _maddsua_simd_workbench
#define _maddsua_simd_workbench
#include <stdint.h>
#include <stdio.h>
#define TEST_RUNS (10U) // 10 test runs
#define TEST_OPS (10000000UL) // by 10 000 000 ops
#define TEST_OPS_RED (1000000UL) // by 1 000 000 ops
inline void print_hex(const uint8_t str[], size_t size) {
for(size_t i = 0; i < size; i++)
printf("%02x", str[i]);
}
inline void print_binary(const uint8_t* data, size_t size) {
for (size_t m = 0; m < size; m++) {
for (size_t n = 0; n < 8; n++)
putc((data[m] & (0b10000000 >> n)) ? '1' : '0', stdout);
printf(" ");
}
}
inline time_t avgtime(time_t* array, size_t length) {
uint64_t temp = 0;
for (size_t i = 0; i < length; i++)
temp += array[i];
return (temp / length);
}
#endif