Changeset: 54f283cbba99 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=54f283cbba99 Modified Files: clients/Tests/exports.stable.out gdk/gdk_calc.c monetdb5/modules/kernel/batstr.c monetdb5/optimizer/Tests/inline08.stable.out sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/backends/monet5/sql_statement.c sql/server/rel_updates.c Branch: unlock Log Message:
Merge with default branch. diffs (truncated from 1638 to 300 lines): diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake --- a/cmake/monetdb-defines.cmake +++ b/cmake/monetdb-defines.cmake @@ -294,6 +294,7 @@ macro(monetdb_configure_sizes) check_type_size(short SIZEOF_SHORT LANGUAGE C) check_type_size(int SIZEOF_INT LANGUAGE C) check_type_size(long SIZEOF_LONG LANGUAGE C) + check_type_size("long int" SIZEOF_LONG_INT LANGUAGE C) check_type_size(double SIZEOF_DOUBLE LANGUAGE C) check_type_size(wchar_t SIZEOF_WCHAR_T LANGUAGE C) check_type_size(socklen_t HAVE_SOCKLEN_T LANGUAGE C) diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c --- a/gdk/gdk_calc.c +++ b/gdk/gdk_calc.c @@ -5617,6 +5617,133 @@ mul_##TYPE1##_##TYPE2##_##TYPE3(const TY return nils; \ } +#ifdef TRUNCATE_NUMBERS +#define roundflt(x) (x) +#define rounddbl(x) (x) +#else +#define roundflt(x) roundf(x) +#define rounddbl(x) round(x) +#endif + +#define absbte(x) abs(x) +#define abssht(x) abs(x) +#define absint(x) abs(x) +#define abslng(x) llabs(x) +#define abshge(x) ABSOLUTE(x) + +#define MUL_INT_FLT_INT(TYPE1, TYPE2, TYPE3) \ +static BUN \ +mul_##TYPE1##_##TYPE2##_##TYPE3( \ + const TYPE1 *lft, bool incr1, const TYPE2 *rgt, bool incr2, \ + TYPE3 *restrict dst, TYPE3 max, \ + struct canditer *restrict ci1, struct canditer *restrict ci2, \ + oid candoff1, oid candoff2, bool abort_on_error) \ +{ \ + BUN nils = 0; \ + BUN i = 0, j = 0; \ + \ + if (ci1->tpe == cand_dense && ci2->tpe == cand_dense) { \ + for (BUN k = 0; k < ci1->ncand; k++) { \ + if (incr1) \ + i = canditer_next_dense(ci1) - candoff1; \ + if (incr2) \ + j = canditer_next_dense(ci2) - candoff2; \ + if (is_##TYPE1##_nil(lft[i]) || is_##TYPE2##_nil(rgt[j])) { \ + dst[k] = TYPE3##_nil; \ + nils++; \ + } else if (lft[i] == 0 || rgt[j] == 0) { \ + dst[k] = 0; \ + } else if (max / fabs(rgt[j]) < abs##TYPE1(lft[i])) { \ + if (abort_on_error) \ + ON_OVERFLOW(TYPE1, TYPE2, "*"); \ + dst[k] = TYPE3##_nil; \ + nils++; \ + } else { \ + double m = lft[i] * rgt[j]; \ + dst[k] = (TYPE3) rounddbl(m); \ + } \ + } \ + } else { \ + for (BUN k = 0; k < ci1->ncand; k++) { \ + if (incr1) \ + i = canditer_next(ci1) - candoff1; \ + if (incr2) \ + j = canditer_next(ci2) - candoff2; \ + if (is_##TYPE1##_nil(lft[i]) || is_##TYPE2##_nil(rgt[j])) { \ + dst[k] = TYPE3##_nil; \ + nils++; \ + } else if (lft[i] == 0 || rgt[j] == 0) { \ + dst[k] = 0; \ + } else if (max / fabs(rgt[j]) < abs##TYPE1(lft[i])) { \ + if (abort_on_error) \ + ON_OVERFLOW(TYPE1, TYPE2, "*"); \ + dst[k] = TYPE3##_nil; \ + nils++; \ + } else { \ + double m = lft[i] * rgt[j]; \ + dst[k] = (TYPE3) rounddbl(m); \ + } \ + } \ + } \ + return nils; \ +} + +MUL_INT_FLT_INT(bte, flt, bte) +MUL_INT_FLT_INT(bte, flt, sht) +MUL_INT_FLT_INT(bte, flt, int) +MUL_INT_FLT_INT(bte, flt, lng) +MUL_INT_FLT_INT(sht, flt, bte) +MUL_INT_FLT_INT(sht, flt, sht) +MUL_INT_FLT_INT(sht, flt, int) +MUL_INT_FLT_INT(sht, flt, lng) +MUL_INT_FLT_INT(int, flt, bte) +MUL_INT_FLT_INT(int, flt, sht) +MUL_INT_FLT_INT(int, flt, int) +MUL_INT_FLT_INT(int, flt, lng) +MUL_INT_FLT_INT(lng, flt, bte) +MUL_INT_FLT_INT(lng, flt, sht) +MUL_INT_FLT_INT(lng, flt, int) +MUL_INT_FLT_INT(lng, flt, lng) +#ifdef HAVE_HGE +MUL_INT_FLT_INT(bte, flt, hge) +MUL_INT_FLT_INT(sht, flt, hge) +MUL_INT_FLT_INT(int, flt, hge) +MUL_INT_FLT_INT(lng, flt, hge) +MUL_INT_FLT_INT(hge, flt, bte) +MUL_INT_FLT_INT(hge, flt, sht) +MUL_INT_FLT_INT(hge, flt, int) +MUL_INT_FLT_INT(hge, flt, lng) +MUL_INT_FLT_INT(hge, flt, hge) +#endif + +MUL_INT_FLT_INT(bte, dbl, bte) +MUL_INT_FLT_INT(bte, dbl, sht) +MUL_INT_FLT_INT(bte, dbl, int) +MUL_INT_FLT_INT(bte, dbl, lng) +MUL_INT_FLT_INT(sht, dbl, bte) +MUL_INT_FLT_INT(sht, dbl, sht) +MUL_INT_FLT_INT(sht, dbl, int) +MUL_INT_FLT_INT(sht, dbl, lng) +MUL_INT_FLT_INT(int, dbl, bte) +MUL_INT_FLT_INT(int, dbl, sht) +MUL_INT_FLT_INT(int, dbl, int) +MUL_INT_FLT_INT(int, dbl, lng) +MUL_INT_FLT_INT(lng, dbl, bte) +MUL_INT_FLT_INT(lng, dbl, sht) +MUL_INT_FLT_INT(lng, dbl, int) +MUL_INT_FLT_INT(lng, dbl, lng) +#ifdef HAVE_HGE +MUL_INT_FLT_INT(bte, dbl, hge) +MUL_INT_FLT_INT(sht, dbl, hge) +MUL_INT_FLT_INT(int, dbl, hge) +MUL_INT_FLT_INT(lng, dbl, hge) +MUL_INT_FLT_INT(hge, dbl, bte) +MUL_INT_FLT_INT(hge, dbl, sht) +MUL_INT_FLT_INT(hge, dbl, int) +MUL_INT_FLT_INT(hge, dbl, lng) +MUL_INT_FLT_INT(hge, dbl, hge) +#endif + MUL_4TYPE(bte, bte, bte, sht, I) MUL_3TYPE_enlarge(bte, bte, sht, I) MUL_3TYPE_enlarge(bte, bte, int, I) @@ -6013,6 +6140,43 @@ mul_typeswitchloop(const void *lft, int #endif case TYPE_flt: switch (tp) { + case TYPE_bte: + nils = mul_bte_flt_bte(lft, incr1, rgt, incr2, + dst, GDK_bte_max, + ci1, ci2, + candoff1, candoff2, + abort_on_error); + break; + case TYPE_sht: + nils = mul_bte_flt_sht(lft, incr1, rgt, incr2, + dst, GDK_sht_max, + ci1, ci2, + candoff1, candoff2, + abort_on_error); + break; + case TYPE_int: + nils = mul_bte_flt_int(lft, incr1, rgt, incr2, + dst, GDK_int_max, + ci1, ci2, + candoff1, candoff2, + abort_on_error); + break; + case TYPE_lng: + nils = mul_bte_flt_lng(lft, incr1, rgt, incr2, + dst, GDK_lng_max, + ci1, ci2, + candoff1, candoff2, + abort_on_error); + break; +#ifdef HAVE_HGE + case TYPE_hge: + nils = mul_bte_flt_hge(lft, incr1, rgt, incr2, + dst, GDK_hge_max, + ci1, ci2, + candoff1, candoff2, + abort_on_error); + break; +#endif case TYPE_flt: nils = mul_bte_flt_flt(lft, incr1, rgt, incr2, dst, GDK_flt_max, @@ -6031,6 +6195,43 @@ mul_typeswitchloop(const void *lft, int break; case TYPE_dbl: switch (tp) { + case TYPE_bte: + nils = mul_bte_dbl_bte(lft, incr1, rgt, incr2, + dst, GDK_bte_max, + ci1, ci2, + candoff1, candoff2, + abort_on_error); + break; + case TYPE_sht: + nils = mul_bte_dbl_sht(lft, incr1, rgt, incr2, + dst, GDK_sht_max, + ci1, ci2, + candoff1, candoff2, + abort_on_error); + break; + case TYPE_int: + nils = mul_bte_dbl_int(lft, incr1, rgt, incr2, + dst, GDK_int_max, + ci1, ci2, + candoff1, candoff2, + abort_on_error); + break; + case TYPE_lng: + nils = mul_bte_dbl_lng(lft, incr1, rgt, incr2, + dst, GDK_lng_max, + ci1, ci2, + candoff1, candoff2, + abort_on_error); + break; +#ifdef HAVE_HGE + case TYPE_hge: + nils = mul_bte_dbl_hge(lft, incr1, rgt, incr2, + dst, GDK_hge_max, + ci1, ci2, + candoff1, candoff2, + abort_on_error); + break; +#endif case TYPE_dbl: nils = mul_bte_dbl_dbl(lft, incr1, rgt, incr2, dst, GDK_dbl_max, @@ -6233,6 +6434,43 @@ mul_typeswitchloop(const void *lft, int #endif case TYPE_flt: switch (tp) { + case TYPE_bte: + nils = mul_sht_flt_bte(lft, incr1, rgt, incr2, + dst, GDK_bte_max, + ci1, ci2, + candoff1, candoff2, + abort_on_error); + break; + case TYPE_sht: + nils = mul_sht_flt_sht(lft, incr1, rgt, incr2, + dst, GDK_sht_max, + ci1, ci2, + candoff1, candoff2, + abort_on_error); + break; + case TYPE_int: + nils = mul_sht_flt_int(lft, incr1, rgt, incr2, + dst, GDK_int_max, + ci1, ci2, + candoff1, candoff2, + abort_on_error); + break; + case TYPE_lng: + nils = mul_sht_flt_lng(lft, incr1, rgt, incr2, + dst, GDK_lng_max, + ci1, ci2, + candoff1, candoff2, + abort_on_error); + break; +#ifdef HAVE_HGE + case TYPE_hge: + nils = mul_sht_flt_hge(lft, incr1, rgt, incr2, + dst, GDK_hge_max, + ci1, ci2, + candoff1, candoff2, + abort_on_error); + break; +#endif case TYPE_flt: nils = mul_sht_flt_flt(lft, incr1, rgt, incr2, dst, GDK_flt_max, @@ -6251,6 +6489,43 @@ mul_typeswitchloop(const void *lft, int break; case TYPE_dbl: switch (tp) { + case TYPE_bte: + nils = mul_sht_dbl_bte(lft, incr1, rgt, incr2, + dst, GDK_bte_max, + ci1, ci2, + candoff1, candoff2, + abort_on_error); + break; + case TYPE_sht: + nils = mul_sht_dbl_sht(lft, incr1, rgt, incr2, + dst, GDK_sht_max, + ci1, ci2, + candoff1, candoff2, + abort_on_error); + break; + case TYPE_int: + nils = mul_sht_dbl_int(lft, incr1, rgt, incr2, _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list