X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=results.c;h=82013cb6218e9896d4256a97b49f513eba57b640;hb=ac8720a930e5757a72f73e80aff7a988b0082831;hp=161f2956bf86ee75cc027f148717156fc30db21a;hpb=34c353ceb1b989394b9f8c09cfc4c1c51ab42bc4;p=SXSI%2Fxpathcomp.git diff --git a/results.c b/results.c index 161f295..82013cb 100644 --- a/results.c +++ b/results.c @@ -26,8 +26,11 @@ results createResults (int n) { fprintf(stderr,"Error, redefine logW as %i and recompile\n",lg(W)-1); exit(1); } + R.n = 2*n-1; R.lgn = lg(n); + //fprintf(stderr,"Size of the result set : %i elements, %li kB\n", n, + //(((R.n+W-1)/W)*sizeof(int)/1024)); R.tree = (int*) malloc (((R.n+W-1)/W)*sizeof(int)); clearBit(R.tree,0); // clear all return R; @@ -181,9 +184,9 @@ static int nextLarger (int *tree, int n, int p, int pos, int pot) { int answ; if (!getBit(tree,pos)) return -1; // no answer - pot--; pos = (pos<<1)+1; if (pos >= n) return 0; // when n is not a power of 2, missing leaves + pot--; if ((p>>pot) == 0) // p goes left { answ = nextLarger(tree,n,p&~(1<