-
Notifications
You must be signed in to change notification settings - Fork 8
/
key.c
44 lines (40 loc) · 848 Bytes
/
key.c
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
#include "key.h"
int key_in_range(int check, int bound1, int bound2, int half) {
if (bound1 > bound2) {
if (half) {
if (check <= bound2 || check > bound1) {
return TRUE;
}
}
else {
if (check < bound2 || check > bound1) {
return TRUE;
}
}
}
else {
if (half) {
if (check > bound1 && check <= bound2) {
return TRUE;
}
}
else {
if (check > bound1 && check < bound2) {
return TRUE;
}
}
}
return FALSE;
/* half enclosed range */
if (half) {
/* per III.C of the paper range is (a, b] in find_successor() */
return (check > bound1 && check <= bound2);
}
else {
return (check > bound1 && check < bound2);
}
}
int key_init(Node *node, int idx) {
/* @TODO: what is this supposed to do? */
return idx;
}