[Monetdb-developers] MX files

David Pennell dpennell at good-cloud.com
Fri Dec 30 03:26:04 CET 2011


Where can I learn more about mx files?

In particular, in the following code, it looks like @2 is derived from the
type expands this into a multitude of type specific functions.  I can't
figure out what @3 is.  Is there a list of these?

SORTfndlast_ at 2(BAT *b, ptr v)
{
BUN diff, end = BUNlast(b), cur = end;
BUN lo = BUNfirst(b), hi = end;
int cmp = 1;
BATiter bi = bat_iterator(b);

        if (lo >= hi || @3_CMP(BUNt at 1(bi, cur - 1), v, @4)<=0) {
/* shortcut: if BAT is empty or last (and hence all) tail
 * value is <= v, we're done. */
return cur;
}
while (lo < hi) {
BUN mid = (lo + hi) >> 1;
cur = mid;
cmp = @3_CMP(BUNt at 1(bi, cur), v, @4);
if (cmp < 0) {
lo = ++mid;
cur++;
} else if (cmp > 0) {
hi = mid;
} else {
break;
}
}
if (cmp == 0 && b->tkey == 0) {  /* shift over multiple equals */
                for(diff = (end-cur)>>1; diff; diff >>= 1) {
    while ((cur+diff) < end && @3_EQ(BUNt at 1(bi, cur+diff), v, @4)) cur +=
diff;
}
}
if (cmp == 0) cur++;
return cur;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.monetdb.org/pipermail/developers-list/attachments/20111229/60be182c/attachment.html>


More information about the developers-list mailing list