Changeset: 7acd9b23592b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7acd9b23592b
Modified Files:
        monetdb5/modules/mal/array.mx
Branch: sciql
Log Message:

ARRAYtilesAvg(): use largest type for temporary sum
to prevent "avoidable" overflow:
sht -> lng
int -> lng
lng -> lng
flt -> dbl
dbl -> dbl


diffs (34 lines):

diff --git a/monetdb5/modules/mal/array.mx b/monetdb5/modules/mal/array.mx
--- a/monetdb5/modules/mal/array.mx
+++ b/monetdb5/modules/mal/array.mx
@@ -859,11 +859,11 @@ ARRAYtilesAvg_@1(Client cntxt, MalBlkPtr
 {
        BAT *bVal = NULL, *bRes = NULL, **bDims = NULL, **bOffsets = NULL;
        int *ret = (int*) getArgReference(stk,pci,0), i = 0, ndims = 0, err = 0;
-       @1 *bValT = NULL;
+       @1 *bValT = NULL, elm = 0;
        dbl *bResT = NULL;
        int **bDimsT = NULL, **bOffsetsT = NULL;
        BUN p, r, arrcnt = 0, offcnt = 0, cnt = 0;
-       @1 sum = 0, elm = 0;
+       @2 sum = 0;
        /* FIXME: this code only deal with INT dimensions */
        int cidx = 0, *dMin = NULL, *dMax = NULL, *dSize = NULL;
        oid arrbase = 0, offbase = 0, vid = 0, mul = 0;
@@ -995,11 +995,11 @@ the tile structure can go over its bound
 embed the array into a slightly larger array, filled with nulls.
 
 @c
-@:tilesAggr(sht)@
-@:tilesAggr(int)@
-@:tilesAggr(lng)@
-@:tilesAggr(flt)@
-@:tilesAggr(dbl)@
+@:tilesAggr(sht,lng)@
+@:tilesAggr(int,lng)@
+@:tilesAggr(lng,lng)@
+@:tilesAggr(flt,dbl)@
+@:tilesAggr(dbl,dbl)@
 str
 ARRAYtilesSum(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) {
        int type = getTailType(getArgType(mb,pci,1));
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to