libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 64e91ef600f5c607b10a07539f33ecb31bd86818
parent 441dbcfe52171c550b696eb45d1d87cb07653823
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Mon, 21 Jun 2021 15:21:03 +0300

Use compiler built-ins for bits rotations if available

Diffstat:
Msrc/microhttpd/mhd_bithelpers.h | 14++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/microhttpd/mhd_bithelpers.h b/src/microhttpd/mhd_bithelpers.h @@ -286,7 +286,10 @@ _MHD_PUT_64BIT_BE_SAFE (void *dst, uint64_t value) #endif /* ! __clang__ */ #define _MHD_ROTR32(value32, bits) \ ((uint32_t) _rotr ((uint32_t) (value32),(bits))) -#else /* ! _MSC_FULL_VER */ +#elif __has_builtin (__builtin_rotateright32) +#define _MHD_ROTR32(value32, bits) \ + ((uint32_t) __builtin_rotateright32 ((value32), (bits))) +#else /* ! __builtin_rotateright32 */ _MHD_static_inline uint32_t _MHD_ROTR32 (uint32_t value32, int bits) { @@ -296,7 +299,7 @@ _MHD_ROTR32 (uint32_t value32, int bits) } -#endif /* ! _MSC_FULL_VER */ +#endif /* ! __builtin_rotateright32 */ /** @@ -311,7 +314,10 @@ _MHD_ROTR32 (uint32_t value32, int bits) #endif /* ! __clang__ */ #define _MHD_ROTL32(value32, bits) \ ((uint32_t) _rotl ((uint32_t) (value32),(bits))) -#else /* ! _MSC_FULL_VER */ +#elif __has_builtin (__builtin_rotateleft32) +#define _MHD_ROTL32(value32, bits) \ + ((uint32_t) __builtin_rotateleft32 ((value32), (bits))) +#else /* ! __builtin_rotateleft32 */ _MHD_static_inline uint32_t _MHD_ROTL32 (uint32_t value32, int bits) { @@ -321,7 +327,7 @@ _MHD_ROTL32 (uint32_t value32, int bits) } -#endif /* ! _MSC_FULL_VER */ +#endif /* ! __builtin_rotateleft32 */ #endif /* ! MHD_BITHELPERS_H */