summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2019-07-23 04:20:19 +0000
committerMarshall Clow <mclow.lists@gmail.com>2019-07-23 04:20:19 +0000
commit30f12a42474f5b8f0409f5aabd3c335fd415b926 (patch)
tree0c7bf91eba01a681946e2b219f02832ad94a5b09
parent57d17ec2e17b8100ecf592d961e85fa867e9af77 (diff)
downloadbcm5719-llvm-30f12a42474f5b8f0409f5aabd3c335fd415b926.tar.gz
bcm5719-llvm-30f12a42474f5b8f0409f5aabd3c335fd415b926.zip
Implement most of P1612R1: Relocate endian. Moves the std::endian functionality from 'type-traits' to 'bit'. No other change. The reason that this is 'partial' is that P1621 also recommends a feature-test macro, but I don't have the value for that one yet. In a month or so, I'll add that
llvm-svn: 366776
-rw-r--r--libcxx/include/bit21
-rw-r--r--libcxx/include/type_traits15
-rw-r--r--libcxx/test/std/numerics/bit/bit.endian/endian.pass.cpp (renamed from libcxx/test/std/utilities/meta/meta.type.synop/endian.pass.cpp)3
3 files changed, 23 insertions, 16 deletions
diff --git a/libcxx/include/bit b/libcxx/include/bit
index 1c0e8ad3ba8..8800b22b7bc 100644
--- a/libcxx/include/bit
+++ b/libcxx/include/bit
@@ -42,6 +42,13 @@ namespace std {
template<class T>
constexpr int popcount(T x) noexcept; // C++20
+ // 20.15.9, endian
+ enum class endian {
+ little = see below, // C++20
+ big = see below, // C++20
+ native = see below // C++20
+};
+
} // namespace std
*/
@@ -456,6 +463,20 @@ log2p1(_Tp __t) noexcept
return __t == 0 ? 0 : __bit_log2(__t) + 1;
}
+
+enum class endian
+{
+ little = 0xDEAD,
+ big = 0xFACE,
+#if defined(_LIBCPP_LITTLE_ENDIAN)
+ native = little
+#elif defined(_LIBCPP_BIG_ENDIAN)
+ native = big
+#else
+ native = 0xCAFE
+#endif
+};
+
#endif // _LIBCPP_STD_VER > 17
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index 5ccafec01f0..e0b6f13fa58 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -3985,21 +3985,6 @@ struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy>
#endif
-#if _LIBCPP_STD_VER > 17
-enum class endian
-{
- little = 0xDEAD,
- big = 0xFACE,
-#if defined(_LIBCPP_LITTLE_ENDIAN)
- native = little
-#elif defined(_LIBCPP_BIG_ENDIAN)
- native = big
-#else
- native = 0xCAFE
-#endif
-};
-#endif
-
#ifndef _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
#if _LIBCPP_STD_VER > 17
_LIBCPP_INLINE_VISIBILITY
diff --git a/libcxx/test/std/utilities/meta/meta.type.synop/endian.pass.cpp b/libcxx/test/std/numerics/bit/bit.endian/endian.pass.cpp
index 52924b357b8..d680fafc4ae 100644
--- a/libcxx/test/std/utilities/meta/meta.type.synop/endian.pass.cpp
+++ b/libcxx/test/std/numerics/bit/bit.endian/endian.pass.cpp
@@ -9,8 +9,9 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// enum class endian;
+// <bit>
-#include <type_traits>
+#include <bit>
#include <cstring>
#include <cassert>
#include <cstdint>
OpenPOWER on IntegriCloud