New rank/select data structure based on sadakane's code
[SXSI/XMLTree.git] / libcds / src / static_bitsequence / sdarray.h
1
2 #ifndef SDARRAY_H
3 #define SDARRAY_H
4
5 #include <basics.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <math.h>
9 #include <sys/timeb.h>
10
11 typedef struct {
12   int n,m;
13   int size;
14   uchar *buf;
15   uint *lp;
16   uint *sl;
17   ushort *ss;
18   uint ss_len, sl_len;
19   uint *p;
20 } selectd2;
21
22 typedef struct {
23   int n,m,d;
24   int size;
25   uchar *hi;
26   uint *low;
27   selectd2 *sd0,*sd1;
28         uint hi_len, low_len;
29
30 } selects3;
31
32 int selects3_construct(selects3 *select, int n, uint *buf);
33 int selects3_select(selects3 *select, int i);
34 int selects3_rank(selects3 *select, int i);
35
36 int setbit(uint *B, int i,int x);
37 int selectd2_save(selectd2 * s, FILE * fp);
38 int selects3_save(selects3 * s, FILE * fp);
39
40 int selectd2_load(selectd2 * s, FILE * fp);
41 int selects3_load(selects3 * s, FILE * fp);
42
43 void selectd2_free(selectd2 * s);
44 void selects3_free(selects3 * s);
45
46
47 #endif
48