fixes ucx_szmul definition for gcc < 5 v2.0

Sun, 07 Oct 2018 09:00:08 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 07 Oct 2018 09:00:08 +0200
changeset 331
3b985a4eb05b
parent 330
d2bbf907a189
child 332
a573926ff318

fixes ucx_szmul definition for gcc < 5

src/ucx.c file | annotate | diff | comparison | revisions
src/ucx/ucx.h file | annotate | diff | comparison | revisions
--- a/src/ucx.c	Fri Sep 28 21:47:30 2018 +0200
+++ b/src/ucx.c	Sun Oct 07 09:00:08 2018 +0200
@@ -45,8 +45,7 @@
 
 #include "ucx/ucx.h"
 
-#ifndef UCX_MUL_BUILTIN
-int ucx_szmul(size_t a, size_t b, size_t *result) {
+int ucx_szmul_impl(size_t a, size_t b, size_t *result) {
     if(a == 0 || b == 0) {
         *result = 0;
         return 0;
@@ -60,5 +59,4 @@
         return 1;
     }
 }
-#endif
 
--- a/src/ucx/ucx.h	Fri Sep 28 21:47:30 2018 +0200
+++ b/src/ucx/ucx.h	Sun Oct 07 09:00:08 2018 +0200
@@ -133,7 +133,7 @@
 
 
 
-#if defined(__GNUC__) || defined(__clang__)
+#if __GNUC__ >= 5 || defined(__clang__)
 #define UCX_MUL_BUILTIN
 
 #if __WORDSIZE == 32
@@ -181,7 +181,9 @@
  * @return zero, if no overflow occurred and the result is correct, non-zero
  * otherwise
  */
-int ucx_szmul(size_t a, size_t b, size_t *result);
+#define ucx_szmul(a, b, result) ucx_szmul_impl(a, b, result)
+
+int ucx_szmul_impl(size_t a, size_t b, size_t *result);
 
 #endif
 

mercurial