Changeset: 6959664833e9 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6959664833e9 Modified Files: monetdb5/modules/mal/xid.c Branch: xid Log Message:
xid.c: use type BUN for counting tuples (BUNs) diffs (212 lines): diff --git a/monetdb5/modules/mal/xid.c b/monetdb5/modules/mal/xid.c --- a/monetdb5/modules/mal/xid.c +++ b/monetdb5/modules/mal/xid.c @@ -42,11 +42,11 @@ typedef struct XIDCOLUMN{ xid tag:XID_TAG_BITS, value:XID_VAL_BITS; } *XIDcolumn; -static xid +static BUN XIDencode(XIDcolumn col, oid *p, oid *q) { oid v, prev=0; - xid i=0,scnt =0; + BUN i=0,scnt =0; //xid point=0, range=0,set=0; col[++i].tag = XIDBASE; @@ -57,7 +57,7 @@ XIDencode(XIDcolumn col, oid *p, oid *q) col[i].tag = XIDPOINT; assert(v <= XID_VAL_MAX); col[i].value = v; - //mnstr_printf(GDKout,"xidpoint %d %ld\n",i,v); + //mnstr_printf(GDKout,"xidpoint " BUNFMT " %ld\n",i,v); break; case XIDSET: /* watch out for duplicates */ @@ -66,7 +66,7 @@ XIDencode(XIDcolumn col, oid *p, oid *q) col[i].value |= ( ((xid)1)<< (v - col[i-1].value)); scnt++; prev= v; - //mnstr_printf(GDKout,"xidset %d %ld\n",i,(v - col[i-1].value)); + //mnstr_printf(GDKout,"xidset " BUNFMT " %ld\n",i,(v - col[i-1].value)); break; } if (scnt == 1) { @@ -79,14 +79,14 @@ XIDencode(XIDcolumn col, oid *p, oid *q) col[i].tag = XIDPOINT; assert(v <= XID_VAL_MAX); col[i].value = v; - //mnstr_printf(GDKout,"xidpoint %d %ld\n",i,v); + //mnstr_printf(GDKout,"xidpoint " BUNFMT " %ld\n",i,v); //point++; break; case XIDRANGE: if ( col[i].value + 1 == v){ assert(v <= XID_VAL_MAX); col[i].value = v; - //mnstr_printf(GDKout,"xidrange %d %ld %ld\n",i,(xid) col[i-1].value, v); + //mnstr_printf(GDKout,"xidrange " BUNFMT " %ld %ld\n",i,(xid) col[i-1].value, v); break; } /* fall back to point if spread to large */ @@ -94,7 +94,7 @@ XIDencode(XIDcolumn col, oid *p, oid *q) col[i].tag = XIDPOINT; assert(v <= XID_VAL_MAX); col[i].value = v; - //mnstr_printf(GDKout,"xidpoint %d %ld\n",i,v); + //mnstr_printf(GDKout,"xidpoint " BUNFMT " %ld\n",i,v); //point++; break; case XIDPOINT: @@ -104,7 +104,7 @@ XIDencode(XIDcolumn col, oid *p, oid *q) col[++i].tag = XIDRANGE; assert(v <= XID_VAL_MAX); col[i].value = v; - //mnstr_printf(GDKout,"xidrange %d %ld %ld\n",i,(xid) col[i-1].value, v); + //mnstr_printf(GDKout,"xidrange " BUNFMT " %ld %ld\n",i,(xid) col[i-1].value, v); //range++; break; } @@ -115,7 +115,7 @@ XIDencode(XIDcolumn col, oid *p, oid *q) scnt = 1; prev = v; col[i].value = (1 << (v -col[i-1].value)); - //mnstr_printf(GDKout,"xidset %d %ld\n",i,(xid) (v- col[i-1].value)); + //mnstr_printf(GDKout,"xidset " BUNFMT " %ld\n",i,(xid) (v- col[i-1].value)); //set++; break; } @@ -123,7 +123,7 @@ XIDencode(XIDcolumn col, oid *p, oid *q) col[i].tag = XIDPOINT; assert(v <= XID_VAL_MAX); col[i].value = v; - //mnstr_printf(GDKout,"xidpoint %d %ld\n",i,v); + //mnstr_printf(GDKout,"xidpoint " BUNFMT " %ld\n",i,v); } } //mnstr_printf(GDKout,"stats point %ld range %ld set %ld\n",point,range,set); @@ -137,7 +137,7 @@ XIDcompress(Client cntxt, MalBlkPtr mb, BAT *b, *bn; oid *p,*q; XIDcolumn col; - xid i=0; + BUN i=0; lng clk; (void) mb; @@ -163,8 +163,8 @@ XIDcompress(Client cntxt, MalBlkPtr mb, i= XIDencode(col,p,q); col[0].tag = XIDBASE; assert(i+1 <= XID_VAL_MAX); - col[0].value = i+1; /* keep compression size */ - mnstr_printf(cntxt->fdout,"#xid, %d, tail compress, " BUNFMT ",%ld, clk " LLFMT " usec\n", + col[0].value = (xid)(i+1); /* keep compression size */ + mnstr_printf(cntxt->fdout,"#xid, %d, tail compress, " BUNFMT "," BUNFMT ", clk " LLFMT " usec\n", getArg(pci,0), BATcount(b), i, GDKusec()-clk); bn->T->heap.xidcompressed = 1; @@ -187,8 +187,8 @@ XIDcompress(Client cntxt, MalBlkPtr mb, i= XIDencode(col,p,q); col[0].tag = XIDBASE; assert(i+1 <= XID_VAL_MAX); - col[0].value = i+1; /* keep compression size */ - mnstr_printf(cntxt->fdout,"#xid, %d, head compress, " BUNFMT ",%ld, clk " LLFMT " usec\n", + col[0].value = (xid)(i+1); /* keep compression size */ + mnstr_printf(cntxt->fdout,"#xid, %d, head compress, " BUNFMT "," BUNFMT ", clk " LLFMT " usec\n", getArg(pci,0), BATcount(b), i, GDKusec()-clk); bn->H->heap.xidcompressed = 1; bn->batDirty =1; @@ -208,10 +208,10 @@ XIDcompress(Client cntxt, MalBlkPtr mb, return MAL_SUCCEED; } -static xid XIDdecode(XIDcolumn col, oid *o, xid lim) +static BUN XIDdecode(XIDcolumn col, oid *o, BUN lim) { oid v,w; - xid cnt=0, i,j; + BUN cnt=0, i,j; for (i=1 ; i<lim ; i++) { v = col[i].value; @@ -245,7 +245,7 @@ XIDdecompress(Client cntxt, MalBlkPtr mb int *ret = (int*) getArgReference(stk,pci,0); int *bid = (int*) getArgReference(stk,pci,1); BAT *b, *bn; - xid cnt, lim; + BUN cnt, lim; XIDcolumn col; oid *o; lng clk; @@ -269,12 +269,12 @@ XIDdecompress(Client cntxt, MalBlkPtr mb if ( b->T->heap.xidcompressed ) { col = (XIDcolumn) b->T->heap.base; - lim = col[0].value; + lim = (BUN) col[0].value; o = (oid*)Tloc(bn,BUNfirst(bn)); clk = GDKusec(); cnt = XIDdecode(col,o,lim); - mnstr_printf(cntxt->fdout,"#xid, %d, decompress, %ld, %ld, clk " LLFMT " usec\n", + mnstr_printf(cntxt->fdout,"#xid, %d, decompress, " BUNFMT ", " BUNFMT ", clk " LLFMT " usec\n", getArg(pci,1), lim, cnt, GDKusec()-clk); BATsetcount(bn, cnt); @@ -292,12 +292,12 @@ XIDdecompress(Client cntxt, MalBlkPtr mb if ( b->H->heap.xidcompressed ) { col = (XIDcolumn) b->H->heap.base; - lim = col[0].value; + lim = (BUN) col[0].value; o = (oid*)Hloc(bn,BUNfirst(bn)); clk = GDKusec(); cnt = XIDdecode(col,o,lim); - mnstr_printf(cntxt->fdout,"#xid, %d, decompress, %ld, %ld , clk " LLFMT " usec\n", + mnstr_printf(cntxt->fdout,"#xid, %d, decompress, " BUNFMT ", " BUNFMT " , clk " LLFMT " usec\n", getArg(pci,1), lim, cnt, GDKusec()-clk); BATsetcount(bn, cnt); @@ -317,10 +317,10 @@ XIDdecompress(Client cntxt, MalBlkPtr mb return MAL_SUCCEED; } -static void XIDcolumndump(stream *f, XIDcolumn col, xid lim) +static void XIDcolumndump(stream *f, XIDcolumn col, BUN lim) { oid v; - xid i; + BUN i; for ( i=1 ; i<lim; i++) { v = col[i].value; @@ -346,22 +346,22 @@ XIDdump(int *ret, int *bid) { BAT *b; XIDcolumn col; - xid lim; + BUN lim; if ((b = BATdescriptor(*bid)) == NULL) throw(MAL, "xid.dump", INTERNAL_BAT_ACCESS); if ( b->T->heap.xidcompressed){ col = (XIDcolumn) b->T->heap.base; - lim = col[0].value; + lim = (BUN) col[0].value; - mnstr_printf(GDKout,"column first %ld, size "BUNFMT", \n", lim, BATcount(b)); + mnstr_printf(GDKout,"column first "BUNFMT", size "BUNFMT", \n", lim, BATcount(b)); XIDcolumndump(GDKout,col,lim); } if ( b->H->heap.xidcompressed){ col = (XIDcolumn) b->H->heap.base; - lim = col[0].value; + lim = (BUN) col[0].value; - mnstr_printf(GDKout,"column first %ld, size "BUNFMT", \n", lim, BATcount(b)); + mnstr_printf(GDKout,"column first "BUNFMT", size "BUNFMT", \n", lim, BATcount(b)); XIDcolumndump(GDKout,col,lim); } BBPreleaseref(*bid); _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list