forked from foudrer/Sux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
simple_select.h
50 lines (43 loc) · 1.59 KB
/
simple_select.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
/*
* Sux: Succinct data structures
*
* Copyright (C) 2007-2013 Sebastiano Vigna
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef simple_select_h
#define simple_select_h
using namespace std;
#include <stdint.h>
#include "macros.h"
class simple_select {
private:
const uint64_t *bits;
int64_t *inventory;
uint64_t *exact_spill;
int log2_ones_per_inventory, log2_ones_per_sub16, log2_ones_per_sub64, log2_longwords_per_subinventory,
ones_per_inventory, ones_per_sub16, ones_per_sub64, longwords_per_subinventory, longwords_per_inventory,
ones_per_inventory_mask, ones_per_sub16_mask, ones_per_sub64_mask;
uint64_t num_words, inventory_size, exact_spill_size, num_ones;
public:
simple_select();
simple_select( const uint64_t * const bits, const uint64_t num_bits, const int max_log2_longwords_per_subinventory );
~simple_select();
uint64_t select( const uint64_t rank );
// Just for analysis purposes
void print_counts();
uint64_t bit_count();
};
#endif