[libdvdcss-devel] [Git][videolan/libdvdcss][master] bswap: fix compilation with older compilers

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Tue Aug 19 09:08:59 UTC 2025



Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdcss


Commits:
bd1340f1 by Steve Lhomme at 2025-08-19T09:53:27+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/libdvdcss/-/commit/bd1340f10b8e3073c5345702283e97e3413a9b43

-- 
View it on GitLab: https://code.videolan.org/videolan/libdvdcss/-/commit/bd1340f10b8e3073c5345702283e97e3413a9b43
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the libdvdcss-devel mailing list