[libdvdnav-devel] [Git][videolan/libdvdread][master] bswap: fix compilation with older compilers
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Tue Aug 19 09:07:26 UTC 2025
Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdread
Commits:
fba5b12c by Steve Lhomme at 2025-08-19T09:55:25+02:00
bswap: fix compilation with older compilers
```
../src/bswap.h:33:43: error: missing binary operator before token "("
33 | #elif defined(__clang__) && __has_builtin (__builtin_bswap16)
| ^
```
- - - - -
1 changed file:
- src/bswap.h
Changes:
=====================================
src/bswap.h
=====================================
@@ -30,19 +30,24 @@
#define B2N_32(x) (void)(x)
#define B2N_64(x) (void)(x)
-#elif defined(__clang__) && __has_builtin (__builtin_bswap16)
+#else /* WORDS_BIGENDIAN */
-#define B2N_16(x) x = __builtin_bswap16(x)
-#define B2N_32(x) x = __builtin_bswap32(x)
-#define B2N_64(x) x = __builtin_bswap64(x)
+#if defined(__clang__)
+# if __has_builtin (__builtin_bswap16)
+# define BSWAP_BUILTIN 1
+# endif
#elif defined (__GNUC__) && ((__GNUC__ > (4)) || (__GNUC__ == (4) && __GNUC_MINOR__ >= (8)))
+# define BSWAP_BUILTIN 1
+#endif
+
+#if defined(BSWAP_BUILTIN)
#define B2N_16(x) x = __builtin_bswap16(x)
#define B2N_32(x) x = __builtin_bswap32(x)
#define B2N_64(x) x = __builtin_bswap64(x)
-#else
+#else /* BSWAP_BUILTIN */
/* For __FreeBSD_version */
#if defined(HAVE_SYS_PARAM_H)
@@ -125,6 +130,8 @@
#endif
+#endif /* BSWAP_BUILTIN */
+
#endif /* WORDS_BIGENDIAN */
#endif /* LIBDVDREAD_BSWAP_H */
View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/commit/fba5b12c16deb42e8c745cf3364a36ec21c031d2
--
View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/commit/fba5b12c16deb42e8c745cf3364a36ec21c031d2
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the libdvdnav-devel
mailing list