diff --git a/ext/bcmath/libbcmath/src/private.h b/ext/bcmath/libbcmath/src/private.h index f21bef665f95..1403baad0c25 100644 --- a/ext/bcmath/libbcmath/src/private.h +++ b/ext/bcmath/libbcmath/src/private.h @@ -41,25 +41,25 @@ #define SWAR_REPEAT(x) (SWAR_ONES * (x)) /* Bytes swap */ -#if defined(_MSC_VER) +#ifdef _MSC_VER # include -# define BSWAP32(u) _byteswap_ulong(u) -# define BSWAP64(u) _byteswap_uint64(u) +# define BC_BSWAP32(u) _byteswap_ulong(u) +# define BC_BSWAP64(u) _byteswap_uint64(u) #else -# ifdef __has_builtin +# ifdef __GNUC__ +# define BC_BSWAP32(u) __builtin_bswap32(u) +# define BC_BSWAP64(u) __builtin_bswap64(u) +# elif defined(__has_builtin) # if __has_builtin(__builtin_bswap32) -# define BSWAP32(u) __builtin_bswap32(u) +# define BC_BSWAP32(u) __builtin_bswap32(u) # endif // __has_builtin(__builtin_bswap32) # if __has_builtin(__builtin_bswap64) -# define BSWAP64(u) __builtin_bswap64(u) +# define BC_BSWAP64(u) __builtin_bswap64(u) # endif // __has_builtin(__builtin_bswap64) -# elif defined(__GNUC__) -# define BSWAP32(u) __builtin_bswap32(u) -# define BSWAP64(u) __builtin_bswap64(u) -# endif // __has_builtin -#endif // defined(_MSC_VER) -#ifndef BSWAP32 -inline uint32_t BSWAP32(uint32_t u) +# endif // __GNUC__ +#endif // _MSC_VER +#ifndef BC_BSWAP32 +static inline uint32_t BC_BSWAP32(uint32_t u) { return (((u & 0xff000000) >> 24) | ((u & 0x00ff0000) >> 8) @@ -67,8 +67,8 @@ inline uint32_t BSWAP32(uint32_t u) | ((u & 0x000000ff) << 24)); } #endif -#ifndef BSWAP64 -inline uint64_t BSWAP64(uint64_t u) +#ifndef BC_BSWAP64 +static inline uint64_t BC_BSWAP64(uint64_t u) { return (((u & 0xff00000000000000ULL) >> 56) | ((u & 0x00ff000000000000ULL) >> 40) @@ -82,17 +82,17 @@ inline uint64_t BSWAP64(uint64_t u) #endif #if SIZEOF_SIZE_T >= 8 -#define BC_BSWAP(u) BSWAP64(u) -#define BC_UINT_T uint64_t +# define BC_BSWAP(u) BC_BSWAP64(u) +# define BC_UINT_T uint64_t #else -#define BC_BSWAP(u) BSWAP32(u) -#define BC_UINT_T uint32_t +# define BC_BSWAP(u) BC_BSWAP32(u) +# define BC_UINT_T uint32_t #endif #ifdef WORDS_BIGENDIAN -#define BC_LITTLE_ENDIAN 0 +# define BC_LITTLE_ENDIAN 0 #else -#define BC_LITTLE_ENDIAN 1 +# define BC_LITTLE_ENDIAN 1 #endif