Changeset: 5c60570b5185 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5c60570b5185
Modified Files:
        NT/monetdb_config.h.in
        configure.ag
        gdk/gdk_calc.c
Branch: Feb2013
Log Message:

On capable systems, use 128 bit integers for multiplication with overflow check.


diffs (103 lines):

diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -614,6 +614,9 @@
 /* Define if you have _sys_siglist */
 /* #undef HAVE__SYS_SIGLIST */
 
+/* Define to 1 if the system has the type `__int128'. */
+/* #undef HAVE___INT128 */
+
 /* Define to 1 if the system has the type `__int64'. */
 #define HAVE___INT64 1
 
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2378,7 +2378,7 @@ AC_TYPE_SSIZE_T
 AC_TYPE_PID_T
 AC_TYPE_OFF_T
 
-AC_CHECK_TYPES([__int64, long long])
+AC_CHECK_TYPES([__int64, long long, __int128])
 AC_CHECK_TYPES([ptrdiff_t],,,[#include <stddef.h>
 #include <sys/types.h>])
 AC_CHECK_TYPES(bool)
diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c
--- a/gdk/gdk_calc.c
+++ b/gdk/gdk_calc.c
@@ -3463,7 +3463,11 @@ MUL_3TYPE_enlarge(bte, int, lng)
 MUL_3TYPE_enlarge(bte, int, flt)
 MUL_3TYPE_enlarge(bte, int, dbl)
 #endif
+#ifdef HAVE___INT128
+MUL_4TYPE(bte, lng, lng, __int128)
+#else
 MUL_2TYPE_lng(bte, lng)
+#endif
 #ifdef FULL_IMPLEMENTATION
 MUL_3TYPE_enlarge(bte, lng, flt)
 MUL_3TYPE_enlarge(bte, lng, dbl)
@@ -3491,7 +3495,11 @@ MUL_3TYPE_enlarge(sht, int, lng)
 MUL_3TYPE_enlarge(sht, int, flt)
 MUL_3TYPE_enlarge(sht, int, dbl)
 #endif
+#ifdef HAVE___INT128
+MUL_4TYPE(sht, lng, lng, __int128)
+#else
 MUL_2TYPE_lng(sht, lng)
+#endif
 #ifdef FULL_IMPLEMENTATION
 MUL_3TYPE_enlarge(sht, lng, flt)
 MUL_3TYPE_enlarge(sht, lng, dbl)
@@ -3517,7 +3525,11 @@ MUL_3TYPE_enlarge(int, int, lng)
 MUL_3TYPE_enlarge(int, int, flt)
 MUL_3TYPE_enlarge(int, int, dbl)
 #endif
+#ifdef HAVE___INT128
+MUL_4TYPE(int, lng, lng, __int128)
+#else
 MUL_2TYPE_lng(int, lng)
+#endif
 #ifdef FULL_IMPLEMENTATION
 MUL_3TYPE_enlarge(int, lng, flt)
 MUL_3TYPE_enlarge(int, lng, dbl)
@@ -3525,22 +3537,38 @@ MUL_3TYPE_enlarge(int, lng, dbl)
 MUL_2TYPE_float(int, flt, flt)
 MUL_3TYPE_enlarge(int, flt, dbl)
 MUL_2TYPE_float(int, dbl, dbl)
+#ifdef HAVE___INT128
+MUL_4TYPE(lng, bte, lng, __int128)
+#else
 MUL_2TYPE_lng(lng, bte)
+#endif
 #ifdef FULL_IMPLEMENTATION
 MUL_3TYPE_enlarge(lng, bte, flt)
 MUL_3TYPE_enlarge(lng, bte, dbl)
 #endif
+#ifdef HAVE___INT128
+MUL_4TYPE(lng, sht, lng, __int128)
+#else
 MUL_2TYPE_lng(lng, sht)
+#endif
 #ifdef FULL_IMPLEMENTATION
 MUL_3TYPE_enlarge(lng, sht, flt)
 MUL_3TYPE_enlarge(lng, sht, dbl)
 #endif
+#ifdef HAVE___INT128
+MUL_4TYPE(lng, int, lng, __int128)
+#else
 MUL_2TYPE_lng(lng, int)
+#endif
 #ifdef FULL_IMPLEMENTATION
 MUL_3TYPE_enlarge(lng, int, flt)
 MUL_3TYPE_enlarge(lng, int, dbl)
 #endif
+#ifdef HAVE___INT128
+MUL_4TYPE(lng, lng, lng, __int128)
+#else
 MUL_2TYPE_lng(lng, lng)
+#endif
 #ifdef FULL_IMPLEMENTATION
 MUL_3TYPE_enlarge(lng, lng, flt)
 MUL_3TYPE_enlarge(lng, lng, dbl)
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to