Changeset: 244d4838a02f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=244d4838a02f
Modified Files:
monetdb5/modules/kernel/bat5.c
Branch: Feb2013
Log Message:
Layout.
diffs (210 lines):
diff --git a/monetdb5/modules/kernel/bat5.c b/monetdb5/modules/kernel/bat5.c
--- a/monetdb5/modules/kernel/bat5.c
+++ b/monetdb5/modules/kernel/bat5.c
@@ -97,7 +97,7 @@ local_utoa(size_t i)
return buf;
}
-#define COLLISION 64
+#define COLLISION 64
static void
HASHinfo(BAT *bk, BAT *bv, Hash *h, str s)
@@ -1708,7 +1708,7 @@ BKCgetStorageSize_str(lng *tot, str batn
{
int bid = BBPindex(batname);
- if (bid == 0)
+ if (bid == 0)
throw(MAL, "bat.getStorageSize", RUNTIME_OBJECT_MISSING);
return BKCgetStorageSize(tot, &bid);
}
@@ -2076,18 +2076,21 @@ BKCgetSequenceBase(oid *r, int *bid)
/*
* Shrinking a void-headed BAT using a list of oids to ignore.
*/
-#define shrinkloop(Type) {\
- Type *p = (Type*)Tloc(b, BUNfirst(b));\
- Type *q = (Type*)Tloc(b, BUNlast(b));\
- Type *r = (Type*)Tloc(bn, BUNfirst(bn));\
- cnt=0;\
- for (;p<q; oidx++, p++) {\
- if ( o < ol && *o == oidx ){\
- o++;\
- } else {\
- cnt++;\
- *r++ = *p;\
- } } }
+#define shrinkloop(Type)
\
+ do {
\
+ Type *p = (Type*)Tloc(b, BUNfirst(b)); \
+ Type *q = (Type*)Tloc(b, BUNlast(b)); \
+ Type *r = (Type*)Tloc(bn, BUNfirst(bn)); \
+ cnt=0;
\
+ for (;p<q; oidx++, p++) {
\
+ if ( o < ol && *o == oidx ){ \
+ o++;
\
+ } else {
\
+ cnt++;
\
+ *r++ = *p;
\
+ }
\
+ }
\
+ } while (0)
str
BKCshrinkBAT(int *ret, int *bid, int *did)
@@ -2121,17 +2124,17 @@ BKCshrinkBAT(int *ret, int *bid, int *di
throw(MAL, "bat.shrink", MAL_MALLOC_FAIL );
}
- o = (oid*)Tloc(bs, BUNfirst(bs));
- ol= (oid*)Tloc(bs, BUNlast(bs));
+ o = (oid*)Tloc(bs, BUNfirst(bs));
+ ol= (oid*)Tloc(bs, BUNlast(bs));
switch(ATOMstorage(b->ttype) ){
- case TYPE_bte: shrinkloop(bte) break;
- case TYPE_sht: shrinkloop(sht) break;
- case TYPE_int: shrinkloop(int) break;
- case TYPE_lng: shrinkloop(lng) break;
- case TYPE_flt: shrinkloop(flt) break;
- case TYPE_dbl: shrinkloop(dbl) break;
- case TYPE_oid: shrinkloop(oid) break;
+ case TYPE_bte: shrinkloop(bte); break;
+ case TYPE_sht: shrinkloop(sht); break;
+ case TYPE_int: shrinkloop(int); break;
+ case TYPE_lng: shrinkloop(lng); break;
+ case TYPE_flt: shrinkloop(flt); break;
+ case TYPE_dbl: shrinkloop(dbl); break;
+ case TYPE_oid: shrinkloop(oid); break;
default:
if (ATOMvarsized(bn->ttype)) {
BUN p = BUNfirst(b);
@@ -2149,10 +2152,10 @@ BKCshrinkBAT(int *ret, int *bid, int *di
}
} else {
switch( b->T->width){
- case 1:shrinkloop(bte) break;
- case 2:shrinkloop(sht) break;
- case 4:shrinkloop(int) break;
- case 8:shrinkloop(lng) break;
+ case 1:shrinkloop(bte); break;
+ case 2:shrinkloop(sht); break;
+ case 4:shrinkloop(int); break;
+ case 8:shrinkloop(lng); break;
default:
throw(MAL, "bat.shrink", "Illegal argument
type");
}
@@ -2213,9 +2216,9 @@ BKCshrinkBATmap(int *ret, int *bid, int
throw(MAL, "bat.shrinkMap", MAL_MALLOC_FAIL );
}
- o = (oid*)Tloc(bs, BUNfirst(bs));
- ol= (oid*)Tloc(bs, BUNlast(bs));
- r = (oid*)Tloc(bn, BUNfirst(bn));
+ o = (oid*)Tloc(bs, BUNfirst(bs));
+ ol= (oid*)Tloc(bs, BUNlast(bs));
+ r = (oid*)Tloc(bn, BUNfirst(bn));
lim = BATcount(b);
@@ -2243,22 +2246,24 @@ BKCshrinkBATmap(int *ret, int *bid, int
/*
* Shrinking a void-headed BAT using a list of oids to ignore.
*/
-#define reuseloop(Type) {\
- Type *p = (Type*)Tloc(b, BUNfirst(b));\
- Type *q = (Type*)Tloc(b, BUNlast(b));\
- Type *r = (Type*)Tloc(bn, BUNfirst(bn));\
- for (;p<q; oidx++, p++) {\
- if ( *o == oidx ){\
- while ( *ol == bidx && ol>o) {\
- bidx--;\
- ol--;q--;\
- }\
- *r++ = *(--q);\
- o += (o < ol);\
- bidx--;\
- } else\
- *r++ = *p; \
-} }
+#define reuseloop(Type)
\
+ do {
\
+ Type *p = (Type*)Tloc(b, BUNfirst(b)); \
+ Type *q = (Type*)Tloc(b, BUNlast(b)); \
+ Type *r = (Type*)Tloc(bn, BUNfirst(bn)); \
+ for (;p<q; oidx++, p++) {
\
+ if ( *o == oidx ){
\
+ while ( *ol == bidx && ol>o) { \
+ bidx--;
\
+ ol--;q--;
\
+ }
\
+ *r++ = *(--q);
\
+ o += (o < ol);
\
+ bidx--;
\
+ } else
\
+ *r++ = *p;
\
+ }
\
+ } while (0)
str
BKCreuseBAT(int *ret, int *bid, int *did)
@@ -2292,24 +2297,24 @@ BKCreuseBAT(int *ret, int *bid, int *did
}
bidx= BUNlast(b)-1;
- o = (oid*)Tloc(bs, BUNfirst(bs));
- ol= (oid*)Tloc(bs, BUNlast(bs))-1;
+ o = (oid*)Tloc(bs, BUNfirst(bs));
+ ol= (oid*)Tloc(bs, BUNlast(bs))-1;
switch(ATOMstorage(b->ttype) ){
- case TYPE_bte: reuseloop(bte) break;
- case TYPE_sht: reuseloop(sht) break;
- case TYPE_int: reuseloop(int) break;
- case TYPE_lng: reuseloop(lng) break;
- case TYPE_flt: reuseloop(flt) break;
- case TYPE_dbl: reuseloop(dbl) break;
- case TYPE_oid: reuseloop(oid) break;
+ case TYPE_bte: reuseloop(bte); break;
+ case TYPE_sht: reuseloop(sht); break;
+ case TYPE_int: reuseloop(int); break;
+ case TYPE_lng: reuseloop(lng); break;
+ case TYPE_flt: reuseloop(flt); break;
+ case TYPE_dbl: reuseloop(dbl); break;
+ case TYPE_oid: reuseloop(oid); break;
case TYPE_str: /* to be done based on its index width */
default:
if (ATOMvarsized(bn->ttype)) {
BUN p = BUNfirst(b);
BUN q = BUNlast(b);
BATiter bi = bat_iterator(b);
-
+
for (;p<q; oidx++, p++) {
if ( *o == oidx ){
while ( *ol == bidx && ol>o) {
@@ -2324,10 +2329,10 @@ BKCreuseBAT(int *ret, int *bid, int *did
}
} else {
switch( b->T->width){
- case 1:reuseloop(bte) break;
- case 2:reuseloop(sht) break;
- case 4:reuseloop(int) break;
- case 8:reuseloop(lng) break;
+ case 1:reuseloop(bte); break;
+ case 2:reuseloop(sht); break;
+ case 4:reuseloop(int); break;
+ case 8:reuseloop(lng); break;
default:
throw(MAL, "bat.shrink", "Illegal argument
type");
}
@@ -2394,7 +2399,7 @@ BKCreuseBATmap(int *ret, int *bid, int *
o += (o < ol);
bidx--;
} else
- *r++ = oidx;
+ *r++ = oidx;
}
BATsetcount(bn, BATcount(b)-BATcount(bs));
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list