Changeset: ee8dc429895e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ee8dc429895e
Modified Files:
        cmake/monetdb-defines.cmake
        common/stream/stream.h
        gdk/gdk_join.c
        monetdb_config.h.in
Branch: default
Log Message:

Always check for 128 bit integers, but only define hge type if available and 
requested.
Note, hge is requested by default.


diffs (130 lines):

diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake
--- a/cmake/monetdb-defines.cmake
+++ b/cmake/monetdb-defines.cmake
@@ -246,19 +246,33 @@ macro(monetdb_configure_sizes)
   check_type_size(socklen_t HAVE_SOCKLEN_T LANGUAGE C)
   cmake_pop_check_state()
 
+  cmake_push_check_state()
+  check_type_size(__int128 SIZEOF___INT128 LANGUAGE C)
+  check_type_size(__int128_t SIZEOF___INT128_T LANGUAGE C)
+  check_type_size(__uint128_t SIZEOF___UINT128_T LANGUAGE C)
   if(INT128)
-    cmake_push_check_state()
-    check_type_size(__int128 SIZEOF___INT128 LANGUAGE C)
-    check_type_size(__int128_t SIZEOF___INT128_T LANGUAGE C)
-    check_type_size(__uint128_t SIZEOF___UINT128_T LANGUAGE C)
-    if(HAVE_SIZEOF___INT128 OR HAVE_SIZEOF___INT128_T OR 
HAVE_SIZEOF___UINT128_T)
+    if(HAVE_SIZEOF___INT128)
       set(HAVE_HGE TRUE)
       message(STATUS "Huge integers are available")
     else()
-      message(STATUS "128-bit integers not supported by this compiler")
+      if(HAVE_SIZEOF___INT128_T AND HAVE_SIZEOF___UINT128_T)
+        set(HAVE_HGE TRUE)
+        message(STATUS "Huge integers are available")
+      else()
+        message(STATUS "128-bit integers not supported by this compiler")
+      endif()
     endif()
-    cmake_pop_check_state()
+  endif()
+  if(HAVE_SIZEOF___INT128)
+    set(HAVE___INT128 TRUE)
   endif()
+  if(HAVE_SIZEOF___INT128_T)
+    set(HAVE___INT128_T TRUE)
+  endif()
+  if(HAVE_SIZEOF___UINT128_T)
+    set(HAVE___UINT128_T TRUE)
+  endif()
+  cmake_pop_check_state()
 
   if(ODBC_FOUND)
     cmake_push_check_state()
diff --git a/common/stream/stream.h b/common/stream/stream.h
--- a/common/stream/stream.h
+++ b/common/stream/stream.h
@@ -39,17 +39,6 @@
 #else
 # define stream_export extern
 #endif
-#ifndef HAVE_HGE
-# ifdef HAVE___INT128
-#  define HAVE_HGE 1
-typedef __int128 hge;
-# else
-#  ifdef HAVE___INT128_T
-#   define HAVE_HGE 1
-typedef __int128_t hge;
-#  endif
-# endif
-#endif
 
 /* Defines to help the compiler check printf-style format arguments.
  * These defines are also in our config.h, but we repeat them here so
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -4462,6 +4462,23 @@ BATbandjoin(BAT **r1p, BAT **r2p, BAT *l
                                break;
                        }
 #else
+#ifdef HAVE___INT128_T
+                       case TYPE_lng: {
+                               if (is_lng_nil(*(const lng *) vr))
+                                       continue;
+                               __int128_t v1 = (__int128_t) *(const lng *) vr, 
v2;
+                               v2 = v1;
+                               v1 -= *(const lng *)c1;
+                               if (*(const lng *)vl <= v1 &&
+                                   (!linc || *(const lng *)vl != v1))
+                                       continue;
+                               v2 += *(const lng *)c2;
+                               if (*(const lng *)vl >= v2 &&
+                                   (!hinc || *(const lng *)vl != v2))
+                                       continue;
+                               break;
+                       }
+#else
                        case TYPE_lng: {
                                if (is_lng_nil(*(const lng *) vr))
                                        continue;
@@ -4491,6 +4508,7 @@ BATbandjoin(BAT **r1p, BAT **r2p, BAT *l
                        }
 #endif
 #endif
+#endif
 #ifdef HAVE_HGE
                        case TYPE_hge: {
                                if (is_hge_nil(*(const hge *) vr))
diff --git a/monetdb_config.h.in b/monetdb_config.h.in
--- a/monetdb_config.h.in
+++ b/monetdb_config.h.in
@@ -334,17 +334,22 @@
 /* The size of `__uint128_t', as computed by sizeof. */
 #cmakedefine SIZEOF___UINT128_T @SIZEOF___UINT128_T@
 
-#ifdef SIZEOF___INT128
+#cmakedefine HAVE___INT128 1
+#cmakedefine HAVE___INT128_T 1
+#cmakedefine HAVE___UINT128_T 1
+#cmakedefine HAVE_HGE 1
+
+#ifdef HAVE_HGE
+#ifdef HAVE___INT128
 typedef __int128 hge;
 typedef unsigned __int128 uhge;
-#define HAVE_HGE 1
 #define SIZEOF_HGE SIZEOF___INT128
-#elif defined(SIZEOF___INT128_T) && defined(SIZEOF___UINT128_T)
+#elif defined(HAVE___INT128_T) && defined(HAVE___UINT128_T)
 typedef __int128_t hge;
 typedef __uint128_t uhge;
-#define HAVE_HGE 1
 #define SIZEOF_HGE SIZEOF___INT128_T
 #endif
+#endif
 
 // End Section: monetdb configure sizes
 
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to