-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.cc
78 lines (62 loc) · 2.19 KB
/
main.cc
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
#include "veb.h"
#include "fusion.h"
#include <set>
#include "util.h"
int main(int argc, char* argv[])
{
FusionTree<unsigned long> test;
//veb<unsigned long long> test;
srand(time(NULL));
std::unordered_set<int> inserts;
std::cout << "Start Inserts" << std::endl;
for(int i = 0; i < 500000; ++i)
{
// test.insert(((unsigned long long)rand()<<32)|rand());
int t = rand();
if(inserts.count(t) > 0)
{
//std::cout << "duplicate value " << t << std::endl;
// exit(1);
}
else {
test.insert(t);
inserts.insert(t);
}
}
std::cout << "Initialize" << std::endl;
test.initialize();
unsigned long next = rand();
std::cout << "Start successor" << std::endl;
std::cout << "suc " << next << ":" << test.successor(next) << std::endl;
// std::set<unsigned long long> rbTree;
// std::cout << "Start RB Tree" << std::endl;
// for(int i = 0; i < 500000; ++i)
// {
// rbTree.insert(rand());
// }
// unsigned long long n = rand();
// std::cout << "Start successor" << std::endl;
// unsigned long long suc = *(rbTree.upper_bound(n));
// std::cout << "suc " << n << ":" << suc << std::endl;
// std::cout << "Test important bits" << std::endl;
// std::vector<unsigned long long > keys;
// keys.push_back(16);
// keys.push_back(20);
// keys.push_back(21);
// keys.push_back(29);
// std::vector<int> msbs = get_impor_bits(keys);
// for(int i = 0; i < msbs.size(); ++i)
// {
// std::cout << msbs[i] << std::endl;
// }
// unsigned long long mask = get_mask<unsigned long long>(msbs);
// std::cout << "mask:" << mask << std::endl;
// unsigned long long m;
// std::vector<int> m_bits = get_m(msbs, m);
// for(int i = 0; i < msbs.size(); ++i)
// std::cout << msbs[i]+m_bits[i] << std::endl;
// std::cout << "gap:" << msbs.back()+m_bits.back()-msbs.front()-m_bits.front() << std::endl;
// std::cout << m << std::endl;
// unsigned long long mh = mul_high(2305843009213693952LL, 2305843009213693952LL);
// std::cout << mh << std::endl;
}