commit 02f91260cad0ea4d1e7db8a008d4dcfa96727a56
parent 6bbfcf648d40c3752890d3b366b4fde83f5543ad
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date: Sun, 7 Sep 2025 12:43:53 +0200
mhd_bithelpers.h: simplified VC macros
Diffstat:
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/mhd2/mhd_bithelpers.h b/src/mhd2/mhd_bithelpers.h
@@ -56,6 +56,7 @@
defined(__OPTIMIZE__)))
/* Declarations for VC & Clang/C2 built-ins */
# include <intrin.h>
+# define mhd_HAS_VC_INTRINSICS 1
#endif /* _MSC_FULL_VER */
#include "mhd_byteorder.h"
@@ -70,9 +71,7 @@ mhd_DATA_TRUNCATION_RUNTIME_CHECK_DISABLE
#ifdef MHD_HAVE___BUILTIN_BSWAP32
# define mhd_BYTES_SWAP32(value32) \
((uint32_t) __builtin_bswap32 ((uint32_t) value32))
-#elif defined(_MSC_FULL_VER) && (! defined(__clang__) || (defined(__c2__) && \
- defined(__OPTIMIZE__)))
-/* Clang/C2 may not inline this function if optimisations are turned off. */
+#elif defined(mhd_HAS_VC_INTRINSICS)
# ifndef __clang__
# pragma intrinsic(_byteswap_ulong)
# endif /* ! __clang__ */
@@ -101,9 +100,7 @@ mhd_BYTES_SWAP32 (uint32_t value32)
#ifdef MHD_HAVE___BUILTIN_BSWAP64
# define mhd_BYTES_SWAP64(value64) \
((uint64_t) __builtin_bswap64 ((uint64_t) value64))
-#elif defined(_MSC_FULL_VER) && (! defined(__clang__) || (defined(__c2__) && \
- defined(__OPTIMIZE__)))
-/* Clang/C2 may not inline this function if optimisations are turned off. */
+#elif defined(mhd_HAS_VC_INTRINSICS)
# ifndef __clang__
# pragma intrinsic(_byteswap_uint64)
# endif /* ! __clang__ */
@@ -531,9 +528,7 @@ mhd_GET_UINTFAST32_BE(const void *addr)
/**
* Rotate right 32-bit value by number of bits.
*/
-#if defined(_MSC_FULL_VER) && (! defined(__clang__) || (defined(__c2__) && \
- defined(__OPTIMIZE__)))
-/* Clang/C2 do not inline this function if optimisations are turned off. */
+#if defined(mhd_HAS_VC_INTRINSICS)
# ifndef __clang__
# pragma intrinsic(_rotr)
# endif /* ! __clang__ */
@@ -560,9 +555,7 @@ mhd_ROTR32 (uint32_t value32, unsigned int bits)
/**
* Rotate left 32-bit value by number of bits.
*/
-#if defined(_MSC_FULL_VER) && (! defined(__clang__) || (defined(__c2__) && \
- defined(__OPTIMIZE__)))
-/* Clang/C2 do not inline this function if optimisations are turned off. */
+#if defined(mhd_HAS_VC_INTRINSICS)
# ifndef __clang__
# pragma intrinsic(_rotl)
# endif /* ! __clang__ */
@@ -589,9 +582,7 @@ mhd_ROTL32 (uint32_t value32, unsigned int bits)
/**
* Rotate right 64-bit value by number of bits.
*/
-#if defined(_MSC_FULL_VER) && (! defined(__clang__) || (defined(__c2__) && \
- defined(__OPTIMIZE__)))
-/* Clang/C2 do not inline this function if optimisations are turned off. */
+#if defined(mhd_HAS_VC_INTRINSICS)
# ifndef __clang__
# pragma intrinsic(_rotr64)
# endif /* ! __clang__ */