Skip to content

Commit e976c2d

Browse files
ext/bcmath: Fixed an issue where macros may become undefined (#14179)
1 parent 2956f55 commit e976c2d

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

ext/bcmath/libbcmath/src/private.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,34 +41,34 @@
4141
#define SWAR_REPEAT(x) (SWAR_ONES * (x))
4242

4343
/* Bytes swap */
44-
#if defined(_MSC_VER)
44+
#ifdef _MSC_VER
4545
# include <stdlib.h>
46-
# define BSWAP32(u) _byteswap_ulong(u)
47-
# define BSWAP64(u) _byteswap_uint64(u)
46+
# define BC_BSWAP32(u) _byteswap_ulong(u)
47+
# define BC_BSWAP64(u) _byteswap_uint64(u)
4848
#else
49-
# ifdef __has_builtin
49+
# ifdef __GNUC__
50+
# define BC_BSWAP32(u) __builtin_bswap32(u)
51+
# define BC_BSWAP64(u) __builtin_bswap64(u)
52+
# elif defined(__has_builtin)
5053
# if __has_builtin(__builtin_bswap32)
51-
# define BSWAP32(u) __builtin_bswap32(u)
54+
# define BC_BSWAP32(u) __builtin_bswap32(u)
5255
# endif // __has_builtin(__builtin_bswap32)
5356
# if __has_builtin(__builtin_bswap64)
54-
# define BSWAP64(u) __builtin_bswap64(u)
57+
# define BC_BSWAP64(u) __builtin_bswap64(u)
5558
# endif // __has_builtin(__builtin_bswap64)
56-
# elif defined(__GNUC__)
57-
# define BSWAP32(u) __builtin_bswap32(u)
58-
# define BSWAP64(u) __builtin_bswap64(u)
59-
# endif // __has_builtin
60-
#endif // defined(_MSC_VER)
61-
#ifndef BSWAP32
62-
inline uint32_t BSWAP32(uint32_t u)
59+
# endif // __GNUC__
60+
#endif // _MSC_VER
61+
#ifndef BC_BSWAP32
62+
static inline uint32_t BC_BSWAP32(uint32_t u)
6363
{
6464
return (((u & 0xff000000) >> 24)
6565
| ((u & 0x00ff0000) >> 8)
6666
| ((u & 0x0000ff00) << 8)
6767
| ((u & 0x000000ff) << 24));
6868
}
6969
#endif
70-
#ifndef BSWAP64
71-
inline uint64_t BSWAP64(uint64_t u)
70+
#ifndef BC_BSWAP64
71+
static inline uint64_t BC_BSWAP64(uint64_t u)
7272
{
7373
return (((u & 0xff00000000000000ULL) >> 56)
7474
| ((u & 0x00ff000000000000ULL) >> 40)
@@ -82,17 +82,17 @@ inline uint64_t BSWAP64(uint64_t u)
8282
#endif
8383

8484
#if SIZEOF_SIZE_T >= 8
85-
#define BC_BSWAP(u) BSWAP64(u)
86-
#define BC_UINT_T uint64_t
85+
# define BC_BSWAP(u) BC_BSWAP64(u)
86+
# define BC_UINT_T uint64_t
8787
#else
88-
#define BC_BSWAP(u) BSWAP32(u)
89-
#define BC_UINT_T uint32_t
88+
# define BC_BSWAP(u) BC_BSWAP32(u)
89+
# define BC_UINT_T uint32_t
9090
#endif
9191

9292
#ifdef WORDS_BIGENDIAN
93-
#define BC_LITTLE_ENDIAN 0
93+
# define BC_LITTLE_ENDIAN 0
9494
#else
95-
#define BC_LITTLE_ENDIAN 1
95+
# define BC_LITTLE_ENDIAN 1
9696
#endif
9797

9898

0 commit comments

Comments
 (0)