Changeset: bc8b74fd9d97 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bc8b74fd9d97 Modified Files: gdk/gdk_aggr.c gdk/gdk_bat.c gdk/gdk_batop.c Branch: Oct2014 Log Message:
Don't use ATOMstorage when the value domain is important. diffs (truncated from 445 to 300 lines): diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c --- a/gdk/gdk_aggr.c +++ b/gdk/gdk_aggr.c @@ -323,10 +323,10 @@ dosum(const void *values, int nonil, oid return BUN_NONE; } - switch (ATOMstorage(tp2)) { + switch (tp2) { case TYPE_bte: { bte *sums = (bte *) results; - switch (ATOMstorage(tp1)) { + switch (tp1) { case TYPE_bte: AGGR_SUM(bte, bte); break; @@ -337,7 +337,7 @@ dosum(const void *values, int nonil, oid } case TYPE_sht: { sht *sums = (sht *) results; - switch (ATOMstorage(tp1)) { + switch (tp1) { case TYPE_bte: AGGR_SUM(bte, sht); break; @@ -349,15 +349,21 @@ dosum(const void *values, int nonil, oid } break; } +#if SIZEOF_WRD == SIZEOF_INT + case TYPE_wrd: +#endif case TYPE_int: { int *sums = (int *) results; - switch (ATOMstorage(tp1)) { + switch (tp1) { case TYPE_bte: AGGR_SUM(bte, int); break; case TYPE_sht: AGGR_SUM(sht, int); break; +#if SIZEOF_WRD == SIZEOF_INT + case TYPE_wrd: +#endif case TYPE_int: AGGR_SUM(int, int); break; @@ -366,18 +372,27 @@ dosum(const void *values, int nonil, oid } break; } +#if SIZEOF_WRD == SIZEOF_LNG + case TYPE_wrd: +#endif case TYPE_lng: { lng *sums = (lng *) results; - switch (ATOMstorage(tp1)) { + switch (tp1) { case TYPE_bte: AGGR_SUM(bte, lng); break; case TYPE_sht: AGGR_SUM(sht, lng); break; +#if SIZEOF_WRD == SIZEOF_INT + case TYPE_wrd: +#endif case TYPE_int: AGGR_SUM(int, lng); break; +#if SIZEOF_WRD == SIZEOF_LNG + case TYPE_wrd: +#endif case TYPE_lng: AGGR_SUM(lng, lng); break; @@ -388,7 +403,7 @@ dosum(const void *values, int nonil, oid } case TYPE_flt: { flt *sums = (flt *) results; - switch (ATOMstorage(tp1)) { + switch (tp1) { case TYPE_flt: AGGR_SUM(flt, flt); break; @@ -399,7 +414,7 @@ dosum(const void *values, int nonil, oid } case TYPE_dbl: { dbl *sums = (dbl *) results; - switch (ATOMstorage(tp1)) { + switch (tp1) { case TYPE_flt: AGGR_SUM(flt, dbl); break; @@ -531,25 +546,32 @@ BATsum(void *res, int tp, BAT *b, BAT *s GDKerror("BATsum: %s\n", err); return GDK_FAIL; } - switch (ATOMstorage(tp)) { + switch (tp) { case TYPE_bte: * (bte *) res = nil_if_empty ? bte_nil : 0; break; case TYPE_sht: * (sht *) res = nil_if_empty ? sht_nil : 0; break; +#if SIZEOF_WRD == SIZEOF_INT + case TYPE_wrd: +#endif case TYPE_int: * (int *) res = nil_if_empty ? int_nil : 0; break; +#if SIZEOF_WRD == SIZEOF_LNG + case TYPE_wrd: +#endif case TYPE_lng: * (lng *) res = nil_if_empty ? lng_nil : 0; break; case TYPE_flt: case TYPE_dbl: - switch (ATOMstorage(b->ttype)) { + switch (b->ttype) { case TYPE_bte: case TYPE_sht: case TYPE_int: + case TYPE_wrd: case TYPE_lng: { /* special case for summing integer types into @@ -572,7 +594,7 @@ BATsum(void *res, int tp, BAT *b, BAT *s /* there were nils */ avg = dbl_nil; } - if (ATOMstorage(tp) == TYPE_flt) { + if (tp == TYPE_flt) { if (avg == dbl_nil) *(flt *) res = flt_nil; else if (cnt > 0 && @@ -604,7 +626,7 @@ BATsum(void *res, int tp, BAT *b, BAT *s default: break; } - if (ATOMstorage(b->ttype) == TYPE_dbl) + if (b->ttype == TYPE_dbl) * (dbl *) res = nil_if_empty ? dbl_nil : 0; else * (flt *) res = nil_if_empty ? flt_nil : 0; @@ -792,10 +814,10 @@ doprod(const void *values, oid seqb, BUN return GDK_FAIL; } - switch (ATOMstorage(tp2)) { + switch (tp2) { case TYPE_bte: { bte *prods = (bte *) results; - switch (ATOMstorage(tp1)) { + switch (tp1) { case TYPE_bte: AGGR_PROD(bte, bte, sht); break; @@ -806,7 +828,7 @@ doprod(const void *values, oid seqb, BUN } case TYPE_sht: { sht *prods = (sht *) results; - switch (ATOMstorage(tp1)) { + switch (tp1) { case TYPE_bte: AGGR_PROD(bte, sht, int); break; @@ -818,9 +840,12 @@ doprod(const void *values, oid seqb, BUN } break; } +#if SIZEOF_WRD == SIZEOF_INT + case TYPE_wrd: +#endif case TYPE_int: { int *prods = (int *) results; - switch (ATOMstorage(tp1)) { + switch (tp1) { case TYPE_bte: AGGR_PROD(bte, int, lng); break; @@ -828,6 +853,9 @@ doprod(const void *values, oid seqb, BUN AGGR_PROD(sht, int, lng); break; case TYPE_int: +#if SIZEOF_WRD == SIZEOF_INT + case TYPE_wrd: +#endif AGGR_PROD(int, int, lng); break; default: @@ -835,9 +863,12 @@ doprod(const void *values, oid seqb, BUN } break; } +#if SIZEOF_WRD == SIZEOF_LNG + case TYPE_wrd: +#endif case TYPE_lng: { lng *prods = (lng *) results; - switch (ATOMstorage(tp1)) { + switch (tp1) { case TYPE_bte: AGGR_PROD_LNG(bte); break; @@ -845,9 +876,15 @@ doprod(const void *values, oid seqb, BUN AGGR_PROD_LNG(sht); break; case TYPE_int: +#if SIZEOF_WRD == SIZEOF_INT + case TYPE_wrd: +#endif AGGR_PROD_LNG(int); break; case TYPE_lng: +#if SIZEOF_WRD == SIZEOF_LNG + case TYPE_wrd: +#endif AGGR_PROD_LNG(lng); break; default: @@ -857,7 +894,7 @@ doprod(const void *values, oid seqb, BUN } case TYPE_flt: { flt *prods = (flt *) results; - switch (ATOMstorage(tp1)) { + switch (tp1) { case TYPE_bte: AGGR_PROD_FLOAT(bte, flt); break; @@ -865,9 +902,15 @@ doprod(const void *values, oid seqb, BUN AGGR_PROD_FLOAT(sht, flt); break; case TYPE_int: +#if SIZEOF_WRD == SIZEOF_INT + case TYPE_wrd: +#endif AGGR_PROD_FLOAT(int, flt); break; case TYPE_lng: +#if SIZEOF_WRD == SIZEOF_LNG + case TYPE_wrd: +#endif AGGR_PROD_FLOAT(lng, flt); break; case TYPE_flt: @@ -880,7 +923,7 @@ doprod(const void *values, oid seqb, BUN } case TYPE_dbl: { dbl *prods = (dbl *) results; - switch (ATOMstorage(tp1)) { + switch (tp1) { case TYPE_bte: AGGR_PROD_FLOAT(bte, dbl); break; @@ -888,9 +931,15 @@ doprod(const void *values, oid seqb, BUN AGGR_PROD_FLOAT(sht, dbl); break; case TYPE_int: +#if SIZEOF_WRD == SIZEOF_INT + case TYPE_wrd: +#endif AGGR_PROD_FLOAT(int, dbl); break; case TYPE_lng: +#if SIZEOF_WRD == SIZEOF_LNG + case TYPE_wrd: +#endif AGGR_PROD_FLOAT(lng, dbl); break; case TYPE_flt: @@ -1032,9 +1081,15 @@ BATprod(void *res, int tp, BAT *b, BAT * * (sht *) res = nil_if_empty ? sht_nil : (sht) 1; break; case TYPE_int: +#if SIZEOF_WRD == SIZEOF_INT + case TYPE_wrd: +#endif * (int *) res = nil_if_empty ? int_nil : (int) 1; break; case TYPE_lng: +#if SIZEOF_WRD == SIZEOF_LNG + case TYPE_wrd: +#endif * (lng *) res = nil_if_empty ? lng_nil : (lng) 1; break; case TYPE_flt: @@ -1276,10 +1331,11 @@ BATgroupavg(BAT **bnp, BAT **cntsp, BAT } /* allocate temporary space to do per group calculations */ - switch (ATOMstorage(b->ttype)) { + switch (b->ttype) { case TYPE_bte: case TYPE_sht: case TYPE_int: + case TYPE_wrd: _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list