Changeset: c57d18f6521f for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c57d18f6521f Modified Files: gdk/gdk_calc.c Branch: Jan2014 Log Message:
Merge with Feb2013 branch. diffs (181 lines): diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c --- a/gdk/gdk_calc.c +++ b/gdk/gdk_calc.c @@ -68,17 +68,19 @@ checkbats(BAT *b1, BAT *b2, const char * return GDK_SUCCEED; } -#define CHECKCAND(dst, i, candoff, NIL) \ - /* cannot use do/while trick because of continue */ \ - if (cand) { \ - if ((i) < *cand - (candoff)) { \ - nils++; \ - (dst)[i] = (NIL); \ - continue; \ - } \ - assert((i) == *cand - (candoff)); \ - if (++cand == (candend)) \ - end = (i) + 1; \ +#define CHECKCAND(dst, i, candoff, NIL) \ + /* cannot use do/while trick because of continue */ \ + /* NOTE: because of the continue, you *must* use the */ \ + /* index (i) to index src/dst */ \ + if (cand) { \ + if ((i) < *cand - (candoff)) { \ + nils++; \ + (dst)[i] = (NIL); \ + continue; \ + } \ + assert((i) == *cand - (candoff)); \ + if (++cand == (candend)) \ + end = (i) + 1; \ } /* fill in NILs from low to high, used to write NILs before and after @@ -8927,13 +8929,11 @@ convert_##TYPE1##_##TYPE2(const TYPE1 *s CANDLOOP(dst, i, TYPE2##_nil, 0, start); \ for (i = start; i < end; i++) { \ CHECKCAND(dst, i, candoff, TYPE2##_nil); \ - if (*src == TYPE1##_nil) { \ - *dst = TYPE2##_nil; \ + if (src[i] == TYPE1##_nil) { \ + dst[i] = TYPE2##_nil; \ nils++; \ } else \ - *dst = (TYPE2) *src; \ - src++; \ - dst++; \ + dst[i] = (TYPE2) src[i]; \ } \ CANDLOOP(dst, i, TYPE2##_nil, end, cnt); \ return nils; \ @@ -8958,19 +8958,17 @@ convert_##TYPE1##_oid(const TYPE1 *src, CANDLOOP(dst, i, oid_nil, 0, start); \ for (i = start; i < end; i++) { \ CHECKCAND(dst, i, candoff, oid_nil); \ - if (*src == TYPE1##_nil) { \ - *dst = oid_nil; \ + if (src[i] == TYPE1##_nil) { \ + dst[i] = oid_nil; \ nils++; \ - } else if (*src < 0) { \ + } else if (src[i] < 0) { \ if (abort_on_error) \ - CONV_OVERFLOW(TYPE1, "oid", *src); \ - *dst = oid_nil; \ + CONV_OVERFLOW(TYPE1, "oid", src[i]); \ + dst[i] = oid_nil; \ nils++; \ - } else if ((*dst = (oid) *src) == oid_nil && \ + } else if ((dst[i] = (oid) src[i]) == oid_nil && \ abort_on_error) \ - CONV_OVERFLOW(TYPE1, "oid", *src); \ - src++; \ - dst++; \ + CONV_OVERFLOW(TYPE1, "oid", src[i]); \ } \ CANDLOOP(dst, i, oid_nil, end, cnt); \ return nils; \ @@ -8988,20 +8986,18 @@ convert_##TYPE1##_oid(const TYPE1 *src, CANDLOOP(dst, i, oid_nil, 0, start); \ for (i = start; i < end; i++) { \ CHECKCAND(dst, i, candoff, oid_nil); \ - if (*src == TYPE1##_nil) { \ - *dst = oid_nil; \ + if (src[i] == TYPE1##_nil) { \ + dst[i] = oid_nil; \ nils++; \ - } else if (*src < 0 || \ - *src > (TYPE1) GDK_oid_max) { \ + } else if (src[i] < 0 || \ + src[i] > (TYPE1) GDK_oid_max) { \ if (abort_on_error) \ - CONV_OVERFLOW(TYPE1, "oid", *src); \ - *dst = oid_nil; \ + CONV_OVERFLOW(TYPE1, "oid", src[i]); \ + dst[i] = oid_nil; \ nils++; \ - } else if ((*dst = (oid) *src) == oid_nil && \ + } else if ((dst[i] = (oid) src[i]) == oid_nil && \ abort_on_error) \ - CONV_OVERFLOW(TYPE1, "oid", *src); \ - src++; \ - dst++; \ + CONV_OVERFLOW(TYPE1, "oid", src[i]); \ } \ CANDLOOP(dst, i, oid_nil, end, cnt); \ return nils; \ @@ -9019,19 +9015,17 @@ convert_##TYPE1##_##TYPE2(const TYPE1 *s CANDLOOP(dst, i, TYPE2##_nil, 0, start); \ for (i = start; i < end; i++) { \ CHECKCAND(dst, i, candoff, TYPE2##_nil); \ - if (*src == TYPE1##_nil) { \ - *dst = TYPE2##_nil; \ - nils++; \ - } else if (*src <= (TYPE1) GDK_##TYPE2##_min || \ - *src > (TYPE1) GDK_##TYPE2##_max) { \ + if (src[i] == TYPE1##_nil) { \ + dst[i] = TYPE2##_nil; \ + nils++; \ + } else if (src[i] <= (TYPE1) GDK_##TYPE2##_min || \ + src[i] > (TYPE1) GDK_##TYPE2##_max) { \ if (abort_on_error) \ - CONV_OVERFLOW(TYPE1, #TYPE2, *src); \ - *dst = TYPE2##_nil; \ + CONV_OVERFLOW(TYPE1, #TYPE2, src[i]); \ + dst[i] = TYPE2##_nil; \ nils++; \ } else \ - *dst = (TYPE2) *src; \ - src++; \ - dst++; \ + dst[i] = (TYPE2) src[i]; \ } \ CANDLOOP(dst, i, TYPE2##_nil, end, cnt); \ return nils; \ @@ -9052,20 +9046,18 @@ convert_##TYPE1##_##TYPE2(const TYPE1 *s CANDLOOP(dst, i, TYPE2##_nil, 0, start); \ for (i = start; i < end; i++) { \ CHECKCAND(dst, i, candoff, TYPE2##_nil); \ - if (*src == TYPE1##_nil) { \ - *dst = TYPE2##_nil; \ + if (src[i] == TYPE1##_nil) { \ + dst[i] = TYPE2##_nil; \ nils++; \ - } else if (*src <= (TYPE1) GDK_##TYPE2##_min || \ - *src > (TYPE1) GDK_##TYPE2##_max) { \ + } else if (src[i] <= (TYPE1) GDK_##TYPE2##_min || \ + src[i] > (TYPE1) GDK_##TYPE2##_max) { \ if (abort_on_error) \ - CONV_OVERFLOW(TYPE1, #TYPE2, *src); \ - *dst = TYPE2##_nil; \ + CONV_OVERFLOW(TYPE1, #TYPE2, src[i]); \ + dst[i] = TYPE2##_nil; \ nils++; \ - } else if ((*dst = (TYPE2) *src) == TYPE2##_nil && \ + } else if ((dst[i] = (TYPE2) src[i]) == TYPE2##_nil && \ abort_on_error) \ - CONV_OVERFLOW(TYPE1, #TYPE2, *src); \ - src++; \ - dst++; \ + CONV_OVERFLOW(TYPE1, #TYPE2, src[i]); \ } \ CANDLOOP(dst, i, TYPE2##_nil, end, cnt); \ return nils; \ @@ -9082,13 +9074,11 @@ convert_##TYPE##_bit(const TYPE *src, bi CANDLOOP(dst, i, bit_nil, 0, start); \ for (i = start; i < end; i++) { \ CHECKCAND(dst, i, candoff, bit_nil); \ - if (*src == TYPE##_nil) { \ - *dst = bit_nil; \ + if (src[i] == TYPE##_nil) { \ + dst[i] = bit_nil; \ nils++; \ } else \ - *dst = (bit) (*src != 0); \ - src++; \ - dst++; \ + dst[i] = (bit) (src[i] != 0); \ } \ CANDLOOP(dst, i, bit_nil, end, cnt); \ return nils; \ _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list