7393fa8b1d
This patch attempts to implement P1272R4 (except for the std::bit_cast changes in there which seem quite unrelated to this and will need to be fixed on the compiler side). While at least for GCC __builtin_bswap{16,32,64,128} should work fine in constant expressions, I wonder about other compilers, so I'm using a fallback implementation for constexpr evaluation always. If you think that is unnecessary, I can drop the __cpp_if_consteval >= 202106L && if !consteval { and } and reformat. The fallback implementation is an attempt to make it work even for integral types that don't have number of bytes divisible by 2 or when __CHAR_BIT__ is e.g. 16. 2021-11-28 Jakub Jelinek <jakub@redhat.com> * include/std/bit (__cpp_lib_byteswap, byteswap): Define. * include/std/version (__cpp_lib_byteswap): Define. * testsuite/26_numerics/bit/bit.byteswap/byteswap.cc: New test. * testsuite/26_numerics/bit/bit.byteswap/version.cc: New test. |
||
---|---|---|
.. | ||
accumulate | ||
adjacent_difference | ||
bit | ||
complex | ||
endian | ||
exclusive_scan | ||
gcd | ||
headers | ||
inclusive_scan | ||
inner_product | ||
iota | ||
lcm | ||
lerp | ||
midpoint | ||
numbers | ||
partial_sum | ||
pstl/numeric_ops | ||
random | ||
reduce | ||
slice | ||
slice_array | ||
transform_exclusive_scan | ||
transform_inclusive_scan | ||
transform_reduce | ||
valarray |