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
     1.1 --- a/src/ucx.c	Fri Sep 28 21:47:30 2018 +0200
     1.2 +++ b/src/ucx.c	Sun Oct 07 09:00:08 2018 +0200
     1.3 @@ -45,8 +45,7 @@
     1.4  
     1.5  #include "ucx/ucx.h"
     1.6  
     1.7 -#ifndef UCX_MUL_BUILTIN
     1.8 -int ucx_szmul(size_t a, size_t b, size_t *result) {
     1.9 +int ucx_szmul_impl(size_t a, size_t b, size_t *result) {
    1.10      if(a == 0 || b == 0) {
    1.11          *result = 0;
    1.12          return 0;
    1.13 @@ -60,5 +59,4 @@
    1.14          return 1;
    1.15      }
    1.16  }
    1.17 -#endif
    1.18  
     2.1 --- a/src/ucx/ucx.h	Fri Sep 28 21:47:30 2018 +0200
     2.2 +++ b/src/ucx/ucx.h	Sun Oct 07 09:00:08 2018 +0200
     2.3 @@ -133,7 +133,7 @@
     2.4  
     2.5  
     2.6  
     2.7 -#if defined(__GNUC__) || defined(__clang__)
     2.8 +#if __GNUC__ >= 5 || defined(__clang__)
     2.9  #define UCX_MUL_BUILTIN
    2.10  
    2.11  #if __WORDSIZE == 32
    2.12 @@ -181,7 +181,9 @@
    2.13   * @return zero, if no overflow occurred and the result is correct, non-zero
    2.14   * otherwise
    2.15   */
    2.16 -int ucx_szmul(size_t a, size_t b, size_t *result);
    2.17 +#define ucx_szmul(a, b, result) ucx_szmul_impl(a, b, result)
    2.18 +
    2.19 +int ucx_szmul_impl(size_t a, size_t b, size_t *result);
    2.20  
    2.21  #endif
    2.22  

mercurial