From 9f6d16ad791e5468ecdb33509cf830577d7aa97a Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Wed, 2 Jan 2019 17:15:06 +0000 Subject: [PATCH] Fix preprocessor macro existence check in bignum.c --- library/bignum.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/library/bignum.c b/library/bignum.c index 503ec537d..bdd6af85c 100644 --- a/library/bignum.c +++ b/library/bignum.c @@ -741,14 +741,19 @@ static mbedtls_mpi_uint mpi_uint_bigendian_to_host( mbedtls_mpi_uint x ) #if ( __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ ) /* For GCC and Clang, have builtins for byte swapping. */ -#if( defined(__GNUC__) && defined(__GNUC_PREREQ) && __GNUC_PREREQ(4,3) ) -#define have_bswap -#elif defined(__clang__) && \ - defined(__has_builtin) && \ - __has_builtin(__builtin_bswap32) && \ - __has_builtin(__builtin_bswap64) +#if defined(__GNUC__) && defined(__GNUC_PREREQ) +#if __GNUC_PREREQ(4,3) #define have_bswap #endif +#endif + +#if defined(__clang__) && defined(__has_builtin) +#if __has_builtin(__builtin_bswap32) && \ + __has_builtin(__builtin_bswap64) +#define have_bswap +#endif +#endif + #if defined(have_bswap) /* The compiler is hopefully able to statically evaluate this! */ switch( sizeof(mbedtls_mpi_uint) )