uint bucket_to_page(headerp, B) {
uint *splits = headerp->hashm_spares;
uint chunk, base, offset, lg2(uint);
chunk = (B<2) ? 0 : lg2(B+1)-1;
base = splits[chunk];
offset = (B<2) ? B : B-(1<chunk);
return (base + offset);
}
int lg2(uint n) {
int i, v;
for (i = 0, v = 1; v < n; v <= 1) i++;
return i;
}
|