We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4d09368 commit d4f0c05Copy full SHA for d4f0c05
libcxx/include/__bit/byteswap.h
@@ -24,6 +24,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
24
25
template <integral _Tp>
26
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp byteswap(_Tp __val) noexcept {
27
+#if __has_builtin(__builtin_bswapg)
28
+ return __builtin_bswapg(__val);
29
+#else
30
if constexpr (sizeof(_Tp) == 1) {
31
return __val;
32
} else if constexpr (sizeof(_Tp) == 2) {
@@ -44,6 +47,7 @@ template <integral _Tp>
44
47
} else {
45
48
static_assert(sizeof(_Tp) == 0, "byteswap is unimplemented for integral types of this size");
46
49
}
50
+#endif
51
52
53
#endif // _LIBCPP_STD_VER >= 23
0 commit comments