Files
86Box/src/include/86box
rilysh 1dfb6fd111 bswap.h: fix GCC requirements for bswap* builtins
1. __builtin_bswap{32,64} were added in GCC 4.3, and __builtin_bswap16
was added in GCC 4.8, however, currently, the GCC requirements in
bswap.h file has >= 10. This requirement of GCC version is false for
bswap* but true for __has_builtin() (as it first was added in GCC 10.1).
As bswap* builtins were added before GCC 10, the preprocessor check will
always going to be true for bswap but will be false if GCC version is
< 10 as __has_builtin() won't be present. Since the byteswap function,
on x86-64, can boil down to a single bswap instruction, this optimization
may left behind (unless GCC do some pattern matching). To avoid this,
just use the compiler macros (for GCC: __GNUC__, clang: __GNUC__ or
__clang__) and if the compiler is neither GCC or Clang, fall-back to
native implementation.

2. Remove the useless casts (uint{16,32,64}_t) from the constants. These
constants already has their own suffix, and casting to a different type
will just get ignored as the return value already gets casts to it's
appropriate type.

3. Previously, Clang couldn't able to use __builtin_bswap* (even if it was
newer) as LLVM define __GNUC__ macro to a specific constant (usually lower
than GCC's (__GNUC__) and on my system it's 4) which is indeed < 10. The
first comment also fixes this issue.

Link: <https://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Other-Builtins.html>
Link: <https://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Other-Builtins.html>
Link: <https://libc-alpha.sourceware.narkive.com/PfaB4BGP/patch-byteswap-h-fix-gcc-ver-test-for-builtin-bswap32>
2024-02-24 23:19:32 +05:30
..
2023-08-15 13:28:04 -04:00
2023-07-04 10:53:44 -04:00
2023-01-08 14:25:18 +01:00
2023-01-08 14:25:18 +01:00
2023-06-27 21:17:13 -04:00
2023-01-08 14:25:18 +01:00
2023-01-08 14:25:18 +01:00
2024-02-06 21:18:25 +01:00
2023-01-08 14:25:18 +01:00
2023-08-23 04:15:58 -04:00
2023-07-04 10:53:44 -04:00
2023-01-08 14:25:18 +01:00
2023-07-04 10:53:44 -04:00
2023-07-04 10:53:44 -04:00
2023-08-23 04:15:58 -04:00
2023-01-08 14:25:18 +01:00
2023-01-08 14:25:18 +01:00
2023-01-08 14:25:18 +01:00
2023-01-08 14:25:18 +01:00
2023-01-08 14:25:18 +01:00
2023-01-08 14:25:18 +01:00
2023-01-08 14:25:18 +01:00
2023-01-08 14:25:18 +01:00
2023-08-23 04:15:58 -04:00
2023-07-04 10:53:44 -04:00
2023-08-23 04:15:58 -04:00
2024-02-18 19:31:39 +05:00
2023-10-05 14:08:09 -03:00
2023-01-08 14:25:18 +01:00
2023-08-23 04:15:58 -04:00
2022-09-18 17:22:54 -04:00
2023-01-08 14:25:18 +01:00
2023-10-13 17:55:18 -04:00
2023-01-08 14:25:18 +01:00
2023-08-23 04:15:58 -04:00
2024-01-20 17:27:24 +01:00
2024-02-13 21:41:01 +05:00
2023-01-08 14:25:18 +01:00
2023-01-08 14:25:18 +01:00
2023-08-14 21:51:47 +02:00
2023-08-14 21:51:47 +02:00
2022-09-18 17:22:54 -04:00
2024-02-14 14:56:25 +05:00
2023-07-04 10:53:44 -04:00
2023-07-04 10:53:44 -04:00
2023-08-23 04:15:58 -04:00
2023-01-08 14:25:18 +01:00
2023-08-23 07:26:48 -04:00
2023-10-20 02:57:50 +02:00
2023-10-20 02:57:50 +02:00
2023-08-15 13:28:04 -04:00
2023-07-04 10:53:44 -04:00
2024-02-13 21:13:25 +05:00
2023-07-04 10:53:44 -04:00
2023-07-04 10:53:44 -04:00
2023-01-08 14:25:18 +01:00
2023-06-26 18:28:13 -04:00
2022-09-18 17:22:54 -04:00
2023-01-08 14:25:18 +01:00
2024-01-29 00:49:13 +05:00
2023-08-23 04:15:58 -04:00
2023-08-23 04:15:58 -04:00
2023-01-08 14:25:18 +01:00
2023-01-08 14:25:18 +01:00
2023-09-20 20:29:32 +02:00
2023-08-23 04:15:58 -04:00
2024-02-02 05:32:43 +01:00
2023-06-26 18:28:13 -04:00
2023-08-23 04:15:58 -04:00
2023-08-23 04:15:58 -04:00
2023-08-15 13:28:04 -04:00
2023-08-23 04:15:58 -04:00
2023-08-15 13:28:04 -04:00
2023-09-21 20:46:11 +02:00
2023-08-23 04:15:58 -04:00
2023-06-26 18:28:13 -04:00
2023-06-26 18:28:13 -04:00
2023-06-26 18:28:13 -04:00
2023-08-23 04:15:58 -04:00
2024-01-08 13:01:55 +13:00
2022-12-19 21:17:59 -05:00
2023-08-23 04:15:58 -04:00
2023-07-25 17:59:22 -04:00
2023-07-31 15:10:30 -04:00
2024-01-08 00:09:35 +01:00
2023-01-08 14:25:18 +01:00
2023-07-31 15:20:29 -04:00
2023-08-14 21:51:47 +02:00
2023-08-14 21:51:47 +02:00
2023-01-08 14:25:18 +01:00
2023-08-23 04:15:58 -04:00
2024-02-07 03:06:19 +01:00
2023-07-31 15:20:29 -04:00
2023-01-08 14:25:18 +01:00
2023-07-25 17:59:22 -04:00
2023-08-15 13:28:04 -04:00
2023-07-25 17:59:22 -04:00
2023-08-15 13:28:04 -04:00
2023-01-08 14:25:18 +01:00
2023-01-08 14:25:18 +01:00
2023-01-08 14:25:18 +01:00
2023-02-14 20:53:59 -05:00
2023-01-08 14:25:18 +01:00
2023-06-26 18:28:13 -04:00