[Git][videolan/libdvdcss][master] bswap: use Clang/GCC builtins for B2N macros

"Jean-Baptiste Kempf (@jbk)" <[email protected]> Thu, 07 Aug 2025 12:28:43 +0200
Newsgroups gmane.comp.video.videolan.libdvdcss.devel
Message-ID <[email protected]>
--===============6969611220060956796==
Content-Type: multipart/alternative;
 boundary="--==_mimepart_68947fdabbb72_80cc5c2fb3018567573";
 charset=UTF-8
Content-Transfer-Encoding: 7bit


----==_mimepart_68947fdabbb72_80cc5c2fb3018567573
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit



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
----==_mimepart_68947fdabbb72_80cc5c2fb3018567573--

--===============6969611220060956796==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libdvdcss-devel mailing list
[email protected]
https://mailman.videolan.org/listinfo/libdvdcss-devel

--===============6969611220060956796==--