[libcxx-commits] [libcxx] [libc++] std::byteswap support for _BitInt(N) (PR #196512)
Xavier Roche via libcxx-commits
libcxx-commits at lists.llvm.org
Sun May 10 07:52:36 PDT 2026
================
@@ -25,25 +25,37 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <integral _Tp>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp byteswap(_Tp __val) noexcept {
if constexpr (sizeof(_Tp) == 1) {
+ // Identity for size-1 types. Handled before the __builtin_bswapg path
+ // because some Clang 22 builds have a constexpr-eval bug on the 1-bit
+ // (bool) case (fixed in commit f5410565137c, post-22.1.0).
----------------
xroche wrote:
AFAICS f5410565137c ; not backported yet in 22.x.
I any case __builtin_bswapg rejects _BitInt(7), _BitInt(13), etc. so size-1 dispatch is needed, but I need to rewrite the condition better.
https://github.com/llvm/llvm-project/pull/196512
More information about the libcxx-commits
mailing list