| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
/* |
|
2
|
|
|
|
|
|
|
* djbsort_dispatch.c - Provides all djbsort_* public API functions |
|
3
|
|
|
|
|
|
|
* for the portable (non-SIMD) build bundled in Sort::DJB. |
|
4
|
|
|
|
|
|
|
* |
|
5
|
|
|
|
|
|
|
* The internal sort files define functions like uint32_sort(), float32_sort(), |
|
6
|
|
|
|
|
|
|
* etc. This file provides the djbsort_* wrappers that call them, plus the |
|
7
|
|
|
|
|
|
|
* metadata functions (version, arch, implementation). |
|
8
|
|
|
|
|
|
|
* |
|
9
|
|
|
|
|
|
|
* Note: djbsort_int32 and djbsort_int64 are provided directly by int32_sort.c |
|
10
|
|
|
|
|
|
|
* and int64_sort.c via the #define in their headers (int32_sort -> djbsort_int32). |
|
11
|
|
|
|
|
|
|
*/ |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#include |
|
14
|
|
|
|
|
|
|
#include |
|
15
|
|
|
|
|
|
|
#include "djbsort.h" |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
/* Internal sort function declarations */ |
|
18
|
|
|
|
|
|
|
extern void uint32_sort(uint32_t *, long long); |
|
19
|
|
|
|
|
|
|
extern void uint32down_sort(uint32_t *, long long); |
|
20
|
|
|
|
|
|
|
extern void int32down_sort(int32_t *, long long); |
|
21
|
|
|
|
|
|
|
extern void float32_sort(float *, long long); |
|
22
|
|
|
|
|
|
|
extern void float32down_sort(float *, long long); |
|
23
|
|
|
|
|
|
|
extern void uint64_sort(uint64_t *, long long); |
|
24
|
|
|
|
|
|
|
extern void uint64down_sort(uint64_t *, long long); |
|
25
|
|
|
|
|
|
|
extern void int64down_sort(int64_t *, long long); |
|
26
|
|
|
|
|
|
|
extern void float64_sort(double *, long long); |
|
27
|
|
|
|
|
|
|
extern void float64down_sort(double *, long long); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
/* Wrappers: call internal functions with djbsort_ prefix */ |
|
30
|
2
|
|
|
|
|
|
void djbsort_uint32(uint32_t *x, long long n) { uint32_sort(x, n); } |
|
31
|
1
|
|
|
|
|
|
void djbsort_uint32down(uint32_t *x, long long n) { uint32down_sort(x, n); } |
|
32
|
2
|
|
|
|
|
|
void djbsort_int32down(int32_t *x, long long n) { int32down_sort(x, n); } |
|
33
|
1
|
|
|
|
|
|
void djbsort_float32(float *x, long long n) { float32_sort(x, n); } |
|
34
|
0
|
|
|
|
|
|
void djbsort_float32down(float *x, long long n) { float32down_sort(x, n); } |
|
35
|
1
|
|
|
|
|
|
void djbsort_uint64(uint64_t *x, long long n) { uint64_sort(x, n); } |
|
36
|
0
|
|
|
|
|
|
void djbsort_uint64down(uint64_t *x, long long n) { uint64down_sort(x, n); } |
|
37
|
1
|
|
|
|
|
|
void djbsort_int64down(int64_t *x, long long n) { int64down_sort(x, n); } |
|
38
|
2
|
|
|
|
|
|
void djbsort_float64(double *x, long long n) { float64_sort(x, n); } |
|
39
|
1
|
|
|
|
|
|
void djbsort_float64down(double *x, long long n) { float64down_sort(x, n); } |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
/* Metadata */ |
|
42
|
2
|
|
|
|
|
|
const char *djbsort_version(void) { return "20260210"; } |
|
43
|
2
|
|
|
|
|
|
const char *djbsort_arch(void) { return "portable"; } |
|
44
|
0
|
|
|
|
|
|
void djbsort_cpuid(unsigned int *result, long long resultlen) { |
|
45
|
0
|
0
|
|
|
|
|
if (resultlen > 0) memset(result, 0, resultlen * sizeof(unsigned int)); |
|
46
|
0
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
/* Implementation info for the portable build */ |
|
49
|
2
|
|
|
|
|
|
const char *djbsort_int32_implementation(void) { return "portable4"; } |
|
50
|
0
|
|
|
|
|
|
const char *djbsort_int32_compiler(void) { return "bundled"; } |
|
51
|
0
|
|
|
|
|
|
const char *djbsort_int64_implementation(void) { return "portable4"; } |
|
52
|
0
|
|
|
|
|
|
const char *djbsort_int64_compiler(void) { return "bundled"; } |
|
53
|
0
|
|
|
|
|
|
long long djbsort_numimpl_int32(void) { return 1; } |
|
54
|
0
|
|
|
|
|
|
long long djbsort_numimpl_int64(void) { return 1; } |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
/* Stub dispatch functions (portable has only one implementation) */ |
|
57
|
0
|
|
|
|
|
|
void (*djbsort_dispatch_int32(long long n))(int32_t *, long long) { |
|
58
|
0
|
|
|
|
|
|
(void)n; return djbsort_int32; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
0
|
|
|
|
|
|
void (*djbsort_dispatch_int64(long long n))(int64_t *, long long) { |
|
61
|
0
|
|
|
|
|
|
(void)n; return djbsort_int64; |
|
62
|
|
|
|
|
|
|
} |