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
use *;
// const REPETITION_TABLE_SIZE: usize = 1;
// #[cfg(feature = "speed")]
// #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
// #[derive(Debug, Clone)]
// pub struct RepetitionTable {
// count_map: Box<[u8]>,
// mask: usize,
// }
// #[cfg(feature = "speed")]
// impl Default for RepetitionTable {
// fn default() -> Self {
// Self::new()
// }
// }
// #[cfg(feature = "speed")]
// impl RepetitionTable {
// pub fn new() -> Self {
// let size = REPETITION_TABLE_SIZE << 20;
// #[cfg(test)]
// debug_assert!(size.is_power_of_two());
// Self {
// count_map: vec![0; size].into_boxed_slice(),
// mask: size - 1,
// }
// }
// #[inline]
// const fn get_index(&self, key: u64) -> usize {
// (key as usize) & self.mask
// }
// #[inline]
// pub fn get_repetition(&self, key: u64) -> u8 {
// *get_item_unchecked!(self.count_map, self.get_index(key))
// }
// #[inline]
// pub fn insert(&mut self, key: u64) {
// *get_item_unchecked_mut!(self.count_map, self.get_index(key)) += 1;
// }
// pub fn insert_and_get_repetition(&mut self, key: u64) -> u8 {
// let count_entry = get_item_unchecked_mut!(self.count_map, self.get_index(key));
// *count_entry += 1;
// *count_entry
// }
// pub fn remove(&mut self, key: u64) {
// let index = self.get_index(key);
// let entry = get_item_unchecked_mut!(self.count_map, index);
// if *entry == 0 {
// panic!(
// "Tried to remove the key {} that doesn't exist!",
// key.stringify()
// )
// }
// *entry -= 1;
// }
// #[inline]
// pub fn clear(&mut self) {
// self.count_map.iter_mut().for_each(|entry| *entry = 0);
// }
// }