]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Remove compiler check for builtin_bitreverse16 since we check in code
authorNathan Moinvaziri <nathan@nathanm.com>
Sun, 11 Jan 2026 00:22:43 +0000 (16:22 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Thu, 15 Jan 2026 20:08:30 +0000 (21:08 +0100)
And we have a generic fallback

CMakeLists.txt
configure
fallback_builtins.h

index c3e49c683cb6fb36c7f0a09ae3ef5c217a8d0eb8..1886413e03fe0461fc46b87683430d26792b95f0 100644 (file)
@@ -647,24 +647,6 @@ if(HAVE_BUILTIN_CTZLL)
 endif()
 set(CMAKE_REQUIRED_FLAGS)
 
-#
-# check for __builtin_bitreverse16() support in the compiler
-#
-set(CMAKE_REQUIRED_FLAGS ${ZNOLTOFLAG})
-check_c_source_compiles(
-    "int main(void) {
-        unsigned short val = 0x1234;
-        unsigned short test = __builtin_bitreverse16(val);
-        (void)test;
-        return 0;
-    }"
-    HAVE_BUILTIN_BITREVERSE16
-)
-if(HAVE_BUILTIN_BITREVERSE16)
-    add_definitions(-DHAVE_BUILTIN_BITREVERSE16)
-endif()
-set(CMAKE_REQUIRED_FLAGS)
-
 #
 # check for ptrdiff_t support
 #
index 7e998f2a07382505e3003b560f930bf91a297558..c3ef99dd0d8371adafe9ff117eb23d25acbf39b2 100755 (executable)
--- a/configure
+++ b/configure
@@ -1168,19 +1168,6 @@ else
     echo "Checking for __builtin_ctzll ... No." | tee -a configure.log
 fi
 
-# Check for __builtin_bitreverse16() support in compiler
-cat > $test.c << EOF
-unsigned short f(unsigned short x) { return __builtin_bitreverse16(x); }
-int main(void) { return 0; }
-EOF
-if try ${CC} ${CFLAGS} $test.c $LDSHAREDLIBC; then
-    echo "Checking for __builtin_bitreverse16 ... Yes." | tee -a configure.log
-    CFLAGS="$CFLAGS -DHAVE_BUILTIN_BITREVERSE16"
-    SFLAGS="$SFLAGS -DHAVE_BUILTIN_BITREVERSE16"
-else
-    echo "Checking for __builtin_bitreverse16 ... No." | tee -a configure.log
-fi
-
 check_avx2_intrinsics() {
     # Check whether compiler supports AVX2 intrinsics
     cat > $test.c << EOF
index 0e6a1f1e176afb4a08275a76c8ad5c8ddcd91d49..b129f96270a88915e4303587ba8af43ad3c1beca 100644 (file)
@@ -42,15 +42,7 @@ Z_FORCEINLINE static int __builtin_ctzll(unsigned long long value) {
 
 #endif // _MSC_VER && !__clang__
 
-/* Double-check whether or not __builtin_bitreverse16 is available. It
-   may not be defined unless compiled for arch. */
-#if !defined(HAVE_BUILTIN_BITREVERSE16) && defined(__has_builtin)
-#  if __has_builtin(__builtin_bitreverse16)
-#    define HAVE_BUILTIN_BITREVERSE16
-#  endif
-#endif
-
-#ifndef HAVE_BUILTIN_BITREVERSE16
+#if !(defined(__has_builtin) && __has_builtin(__builtin_bitreverse16))
 
 #  ifdef __loongarch__
 /* LoongArch bit reversal for 16-bit values */
@@ -71,7 +63,6 @@ Z_FORCEINLINE static uint16_t __builtin_bitreverse16(uint16_t value) {
 #    undef bitrev8
 #  endif
 
-#define HAVE_BUILTIN_BITREVERSE16
-#endif
+#endif // __builtin_bitreverse16
 
 #endif // include guard FALLBACK_BUILTINS_H