-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbsig.c
31 lines (29 loc) · 795 Bytes
/
bsig.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// bsig.c ... functions on Tuple Signatures (bsig's)
// part of SIMC signature files
// Written by John Shepherd, September 2018
#include "defs.h"
#include "reln.h"
#include "query.h"
#include "bsig.h"
#include "psig.h"
void findPagesUsingBitSlices(Query q)
{
assert(q != NULL);
Reln r = q->rel;
Bits qsig = makePageSig(r, q->qstring);
setAllBits(q->pages);
for (int i = 0; i < psigBits(r); i++) {
if (bitIsSet(qsig, i)) {
PageID pid = (i != 0) ? ((i-1) / maxBsigsPP(r)) : (i / maxBsigsPP(r));
Page p = getPage(r->bsigf, pid);
Bits bsig = newBits(bsigBits(r));
int b_i = (i != 0) ? ((i-1) % maxBsigsPP(r)) : (i % maxBsigsPP(r));
getBits(p, b_i, bsig);
for (int j = 0; j < nPsigs(r); j++) {
if (!bitIsSet(bsig, j)) {
unsetBit(q->pages, j);
}
}
}
}
}