src/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
1 / 1
100.0%
Branches:
-
-%
Functions:
1 / 1
100.0%

storage/index/utils/pair.h
Line Branch Exec Source
1 #pragma once
2
3 #include <cstdint>
4 #include <cstdlib>
5
6 typedef uint64_t Key_t;
7 typedef uint64_t Value_t;
8
9 const Key_t SENTINEL = -2; // 11111...110
10 const Key_t INVALID = -1; // 11111...111
11
12 const Value_t NONE = 0;
13
14 struct Pair {
15 Key_t key;
16 Value_t value;
17
18 159360 Pair(void) : key{INVALID} {}
19
20 Pair(Key_t _key, Value_t _value) : key{_key}, value{_value} {}
21
22 Pair& operator=(const Pair& other) {
23 key = other.key;
24 value = other.value;
25 return *this;
26 }
27
28 void* operator new(size_t size) {
29 void* ret;
30 posix_memalign(&ret, 64, size);
31 return ret;
32 }
33
34 void* operator new[](size_t size) {
35 void* ret;
36 posix_memalign(&ret, 64, size);
37 return ret;
38 }
39 };
40