-
Notifications
You must be signed in to change notification settings - Fork 8
/
binary-unrolled.h
120 lines (117 loc) · 1.89 KB
/
binary-unrolled.h
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
static int
NAME (const int *arr, int n, int key)
{
int min = 0, max = n;
#if LOOPS >= 1
#include "binary-step.h"
#endif
#if LOOPS >= 2
#include "binary-step.h"
#endif
#if LOOPS >= 3
#include "binary-step.h"
#endif
#if LOOPS >= 4
#include "binary-step.h"
#endif
#if LOOPS >= 5
#include "binary-step.h"
#endif
#if LOOPS >= 6
#include "binary-step.h"
#endif
#if LOOPS >= 7
#include "binary-step.h"
#endif
#if LOOPS >= 8
#include "binary-step.h"
#endif
#if LOOPS >= 9
#include "binary-step.h"
#endif
#if LOOPS >= 10
#include "binary-step.h"
#endif
#if LOOPS >= 11
#include "binary-step.h"
#endif
#if LOOPS >= 12
#include "binary-step.h"
#endif
#if LOOPS >= 13
#include "binary-step.h"
#endif
#if LOOPS >= 14
#include "binary-step.h"
#endif
#if LOOPS >= 15
#include "binary-step.h"
#endif
#if LOOPS >= 16
#include "binary-step.h"
#endif
#if LOOPS >= 17
#include "binary-step.h"
#endif
#if LOOPS >= 18
#include "binary-step.h"
#endif
#if LOOPS >= 19
#include "binary-step.h"
#endif
#if LOOPS >= 20
#include "binary-step.h"
#endif
#if LOOPS >= 21
#include "binary-step.h"
#endif
#if LOOPS >= 22
#include "binary-step.h"
#endif
#if LOOPS >= 23
#include "binary-step.h"
#endif
#if LOOPS >= 24
#include "binary-step.h"
#endif
#if LOOPS >= 25
#include "binary-step.h"
#endif
#if LOOPS >= 26
#include "binary-step.h"
#endif
#if LOOPS >= 27
#include "binary-step.h"
#endif
#if LOOPS >= 28
#include "binary-step.h"
#endif
#if LOOPS >= 29
#include "binary-step.h"
#endif
#if LOOPS >= 30
#include "binary-step.h"
#endif
#if LOOPS >= 31
#error Cannot unroll more than 30 binary loops
#endif
#if defined(LINEAR_FINISH)
int i = min;
n = max;
#include "linear-loop.h"
return i;
#elif defined(LINEAR_SENTINEL_FINISH)
int i = min;
#include "linear-sentinel-loop.h"
return i;
#else
if (min == max)
return min;
if (arr [min] >= key)
return min;
return min + 1;
#endif
}
#undef NAME
#undef LOOPS
#undef LINEAR_FINISH