[libdvdcss-devel] [Git][videolan/libdvdcss][master] bswap: use Clang/GCC builtins for B2N macros
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Thu Aug 7 10:28:43 UTC 2025
Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdcss
Commits:
abb605b5 by Steve Lhomme at 2025-08-07T11:02:27+02:00
bswap: use Clang/GCC builtins for B2N macros
It should be faster than the OS helpers.
Similar to https://code.videolan.org/videolan/libdvdread/-/merge_requests/50 for libdvdcss.
- - - - -
1 changed file:
- src/bswap.h
Changes:
=====================================
src/bswap.h
=====================================
@@ -30,6 +30,18 @@
#define B2N_32(x) (void)(x)
#define B2N_64(x) (void)(x)
+#elif defined(__clang__) && __has_builtin (__builtin_bswap16)
+
+#define B2N_16(x) x = __builtin_bswap16(x)
+#define B2N_32(x) x = __builtin_bswap32(x)
+#define B2N_64(x) x = __builtin_bswap64(x)
+
+#elif defined (__GNUC__) && ((__GNUC__ > (4)) || (__GNUC__ == (4) && __GNUC_MINOR__ >= (8)))
+
+#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
/* For __FreeBSD_version */
View it on GitLab: https://code.videolan.org/videolan/libdvdcss/-/commit/abb605b5bc985cb88dabebcd4eec9dde7a90dd2c
--
View it on GitLab: https://code.videolan.org/videolan/libdvdcss/-/commit/abb605b5bc985cb88dabebcd4eec9dde7a90dd2c
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