Changeset: b59ba572eb89 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b59ba572eb89
Modified Files:
        common/utils/mstring.h
        gdk/gdk_string.c
        monetdb5/modules/mal/tablet.c
Branch: Aug2024
Log Message:

Implement likely/unlikely compiler hints on Windows.


diffs (54 lines):

diff --git a/common/utils/mstring.h b/common/utils/mstring.h
--- a/common/utils/mstring.h
+++ b/common/utils/mstring.h
@@ -92,9 +92,14 @@ strconcat_len(char *restrict dst, size_t
 #endif
 #endif
 #ifndef unlikely
+#ifdef _MSC_VER
+#define unlikely(expr) (__assume(!(expr)), (expr))
+#define likely(expr)   (__assume((expr)), (expr))
+#else
 #define unlikely(expr) (expr)
 #define likely(expr)   (expr)
 #endif
+#endif
 
 /*
  * UTF-8 encoding is as follows:
diff --git a/gdk/gdk_string.c b/gdk/gdk_string.c
--- a/gdk/gdk_string.c
+++ b/gdk/gdk_string.c
@@ -339,9 +339,14 @@ strPut(BAT *b, var_t *dst, const void *V
 #endif
 #endif
 #ifndef unlikely
+#ifdef _MSC_VER
+#define unlikely(expr) (__assume(!(expr)), (expr))
+#define likely(expr)   (__assume((expr)), (expr))
+#else
 #define unlikely(expr) (expr)
 #define likely(expr)   (expr)
 #endif
+#endif
 
 ssize_t
 GDKstrFromStr(unsigned char *restrict dst, const unsigned char *restrict src, 
ssize_t len, char quote)
diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c
--- a/monetdb5/modules/mal/tablet.c
+++ b/monetdb5/modules/mal/tablet.c
@@ -1226,9 +1226,14 @@ mkdfa(const unsigned char *sep, size_t s
 #endif
 #endif
 #ifndef unlikely
+#ifdef _MSC_VER
+#define unlikely(expr) (__assume(!(expr)), (expr))
+#define likely(expr)   (__assume((expr)), (expr))
+#else
 #define unlikely(expr) (expr)
 #define likely(expr)   (expr)
 #endif
+#endif
 
 static void
 SQLproducer(void *p)
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to