X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=results.c;h=19480fd22d0e3405d00768c4a199f740b80a1177;hb=609094fe14ca90cd5417ee22de621f76d1d0ec94;hp=161f2956bf86ee75cc027f148717156fc30db21a;hpb=34c353ceb1b989394b9f8c09cfc4c1c51ab42bc4;p=SXSI%2Fxpathcomp.git diff --git a/results.c b/results.c index 161f295..19480fd 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<