get rid of empty benchmark
[riscv-tests.git] / benchmarks / sort / sort.h
1 // See LICENSE for license details.
2
3 #include <string.h>
4 #include <stdint.h>
5 #include <stdbool.h>
6
7 #define USE_N_SQUARED_SORT
8
9 #define FAKE_MALLOC_INIT(words, name) \
10 uint32_t heap_##name[words]; \
11 const size_t max_alloc_##name = (words) * sizeof(uint32_t); \
12 size_t cur_pos_##name; \
13 void* fake_malloc_##name( size_t size ) \
14 { \
15 static bool init = false; \
16 if(!init) { \
17 cur_pos_##name = 0; \
18 init = true; \
19 } \
20 if(cur_pos_##name < (words)) { \
21 void *ptr = (void*) &heap_##name[cur_pos_##name]; \
22 cur_pos_##name += size & ~((uint32_t)3) + 1; \
23 return ptr; \
24 } else { \
25 return NULL; \
26 } \
27 }
28
29
30
31 #ifndef _TAV_SORT_H_
32 #define _TAV_SORT_H_
33
34
35 int
36 n_squared_sort (float * value, int * index, int len);
37
38 int
39 radix_sort_tuples (int * value, int * index, int len, int radix_bits);
40
41 int
42 insertion_sort (float * value, int * index, int len);
43
44 int
45 quicksort (float * array, int * index, int len);
46
47 /* This defines the length at quicksort switches to insertion sort */
48 #ifndef MAX_THRESH
49 #define MAX_THRESH 10
50 #endif
51
52 #ifndef RADIX_BITS
53 #define RADIX_BITS (8)
54 #endif
55
56
57 #endif /* _TAV_SORT_H_ */