diff options
author | Werner Koch <wk@gnupg.org> | 2014-01-09 19:14:09 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2014-01-13 11:48:35 +0100 |
commit | 5f2af6c26bc04975c0b518881532871d7387d7ce (patch) | |
tree | cc2f8a30f8be948631249dbc99b90245b0ac6901 /cipher/bithelp.h | |
parent | 518ae274a1845ce626b2b4223a9b3805cbbab1a7 (diff) | |
download | libgcrypt-5f2af6c26bc04975c0b518881532871d7387d7ce.tar.gz |
Fix macro conflict in NetBSD
* cipher/bithelp.h (bswap32): Rename to _gcry_bswap32.
(bswap64): Rename to _gcry_bswap64.
--
NetBSD provides system macros bswap32 and bswap64 which conflicts with
our macros. Prefixing them with _gcry_ is easier than to come up with
a proper test.
GnuPG-bug-id: 1600
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 36214bfa8f612cd2faa4de217d1a12a8b5faadbf)
Diffstat (limited to 'cipher/bithelp.h')
-rw-r--r-- | cipher/bithelp.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/cipher/bithelp.h b/cipher/bithelp.h index 418bdf5c..6e59c53f 100644 --- a/cipher/bithelp.h +++ b/cipher/bithelp.h @@ -39,9 +39,10 @@ static inline u32 ror(u32 x, int n) /* Byte swap for 32-bit and 64-bit integers. If available, use compiler provided helpers. */ #ifdef HAVE_BUILTIN_BSWAP32 -# define bswap32 __builtin_bswap32 +# define _gcry_bswap32 __builtin_bswap32 #else -static inline u32 bswap32(u32 x) +static inline u32 +_gcry_bswap32(u32 x) { return ((rol(x, 8) & 0x00ff00ffL) | (ror(x, 8) & 0xff00ff00L)); } @@ -49,29 +50,30 @@ static inline u32 bswap32(u32 x) #ifdef HAVE_U64_TYPEDEF # ifdef HAVE_BUILTIN_BSWAP64 -# define bswap64 __builtin_bswap64 +# define _gcry_bswap64 __builtin_bswap64 # else -static inline u64 bswap64(u64 x) +static inline u64 +_gcry_bswap64(u64 x) { - return ((u64)bswap32(x) << 32) | (bswap32(x >> 32)); + return ((u64)_gcry_bswap32(x) << 32) | (_gcry_bswap32(x >> 32)); } # endif #endif /* Endian dependent byte swap operations. */ #ifdef WORDS_BIGENDIAN -# define le_bswap32(x) bswap32(x) +# define le_bswap32(x) _gcry_bswap32(x) # define be_bswap32(x) ((u32)(x)) # ifdef HAVE_U64_TYPEDEF -# define le_bswap64(x) bswap64(x) +# define le_bswap64(x) _gcry_bswap64(x) # define be_bswap64(x) ((u64)(x)) # endif #else # define le_bswap32(x) ((u32)(x)) -# define be_bswap32(x) bswap32(x) +# define be_bswap32(x) _gcry_bswap32(x) # ifdef HAVE_U64_TYPEDEF # define le_bswap64(x) ((u64)(x)) -# define be_bswap64(x) bswap64(x) +# define be_bswap64(x) _gcry_bswap64(x) # endif #endif |