]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
__builtin_bitreverse16 CMake compiler check fails for GCC 13
authorNathan Moinvaziri <nathan@nathanm.com>
Sat, 10 Jan 2026 01:38:55 +0000 (17:38 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Thu, 15 Jan 2026 20:08:30 +0000 (21:08 +0100)
Provide a final check for __builtin_bitreverse16 in code.

fallback_builtins.h

index 3b477abd379d6d8de2d7e821b1a99cd7eaee5292..0e6a1f1e176afb4a08275a76c8ad5c8ddcd91d49 100644 (file)
@@ -42,6 +42,14 @@ 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
 
 #  ifdef __loongarch__