mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Release Cosmopolitan v3.6.0
This release is an atomic upgrade to GCC 14.1.0 with C23 and C++23
This commit is contained in:
parent
62ace3623a
commit
5660ec4741
1585 changed files with 117353 additions and 271644 deletions
13
third_party/libcxx/__bit/byteswap.h
vendored
13
third_party/libcxx/__bit/byteswap.h
vendored
|
@ -23,8 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
#if _LIBCPP_STD_VER >= 23
|
||||
|
||||
template <integral _Tp>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr _Tp byteswap(_Tp __val) noexcept {
|
||||
|
||||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp byteswap(_Tp __val) noexcept {
|
||||
if constexpr (sizeof(_Tp) == 1) {
|
||||
return __val;
|
||||
} else if constexpr (sizeof(_Tp) == 2) {
|
||||
|
@ -33,15 +32,15 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp byteswap(_Tp __val) noexcept {
|
|||
return __builtin_bswap32(__val);
|
||||
} else if constexpr (sizeof(_Tp) == 8) {
|
||||
return __builtin_bswap64(__val);
|
||||
#ifndef _LIBCPP_HAS_NO_INT128
|
||||
# ifndef _LIBCPP_HAS_NO_INT128
|
||||
} else if constexpr (sizeof(_Tp) == 16) {
|
||||
#if __has_builtin(__builtin_bswap128)
|
||||
# if __has_builtin(__builtin_bswap128)
|
||||
return __builtin_bswap128(__val);
|
||||
#else
|
||||
# else
|
||||
return static_cast<_Tp>(byteswap(static_cast<uint64_t>(__val))) << 64 |
|
||||
static_cast<_Tp>(byteswap(static_cast<uint64_t>(__val >> 64)));
|
||||
#endif // __has_builtin(__builtin_bswap128)
|
||||
#endif // _LIBCPP_HAS_NO_INT128
|
||||
# endif // __has_builtin(__builtin_bswap128)
|
||||
# endif // _LIBCPP_HAS_NO_INT128
|
||||
} else {
|
||||
static_assert(sizeof(_Tp) == 0, "byteswap is unimplemented for integral types of this size");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue