Optimize sdarray.cpp to use g++ builtin instead of doing naive counting.
[SXSI/libcds.git] / 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   //uint lasti, lasts;
30 } selects3;
31
32 extern unsigned int selecttbl[8*256];
33
34 int selects3_construct(selects3 *select, int n, uint *buf);
35 int selects3_select(selects3 *select, int i);
36 int selects3_rank(selects3 *select, int i);
37 int selects3_selectnext(selects3 *select, int i);
38
39 void make___selecttbl(void);
40 int __setbit(uint *B, int i,int x);
41 int selectd2_save(selectd2 * s, FILE * fp);
42 int selects3_save(selects3 * s, FILE * fp);
43
44 int selectd2_load(selectd2 * s, FILE * fp);
45 int selects3_load(selects3 * s, FILE * fp);
46
47 void selectd2_free(selectd2 * s);
48 void selects3_free(selects3 * s);
49
50
51 #endif
52