summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
137f5dd)
git-svn-id: svn+ssh://idea.nguyen.vg/svn/sxsi/trunk/XMLTree@348
3cdefd35-fc62-479d-8e8d-
bae585ffb9ca
+selects3 * lasts3=NULL;
+int lasti=0;
+int lasts=0;
int selects3_select(selects3 *select, int i) {
int d,x;
int selects3_select(selects3 *select, int i) {
int d,x;
if (i == 0) return -1;
d = select->d;
if (i == 0) return -1;
d = select->d;
-
- x = selectd2_select(select->sd1,i,1) - (i-1);
- x <<= d;
+ if(lasts3==select && lasti==i) {
+ while(!__getbit2(select->sd1->buf,++lasti));
+ }
+ else {
+ lasts = selectd2_select(select->sd1,i,1);
+ }
+ lasti = i;
+ lasts3 = select;
+ x = (lasts-(i-1)) << d;
x += __getbits(select->low,(i-1)*d,d);
return x;
x += __getbits(select->low,(i-1)*d,d);
return x;
}
int selects3_selectnext(selects3 *select, int i) {
}
int selects3_selectnext(selects3 *select, int i) {
+ return selects3_select(select,selects3_rank(select,i)+1);
int d,x,w,y;
int r,j;
int z,ii;
int d,x,w,y;
int r,j;
int z,ii;
uint *low;
selectd2 *sd0,*sd1;
uint hi_len, low_len;
uint *low;
selectd2 *sd0,*sd1;
uint hi_len, low_len;
} selects3;
int selects3_construct(selects3 *select, int n, uint *buf);
} selects3;
int selects3_construct(selects3 *select, int n, uint *buf);