summaryrefslogtreecommitdiffstats
path: root/contrib/libc++/include/cstddef
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libc++/include/cstddef')
-rw-r--r--contrib/libc++/include/cstddef32
1 files changed, 31 insertions, 1 deletions
diff --git a/contrib/libc++/include/cstddef b/contrib/libc++/include/cstddef
index edd106c..6258449 100644
--- a/contrib/libc++/include/cstddef
+++ b/contrib/libc++/include/cstddef
@@ -28,6 +28,7 @@ Types:
size_t
max_align_t
nullptr_t
+ byte // C++17
} // std
@@ -48,7 +49,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
using ::ptrdiff_t;
using ::size_t;
-#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T)
+#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \
+ defined(__DEFINED_max_align_t)
// Re-use the compiler's <stddef.h> max_align_t where possible.
using ::max_align_t;
#else
@@ -57,4 +59,32 @@ typedef long double max_align_t;
_LIBCPP_END_NAMESPACE_STD
+#if _LIBCPP_STD_VER > 14
+namespace std // purposefully not versioned
+{
+enum class byte : unsigned char {};
+
+constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept
+{ return __lhs = byte(static_cast<unsigned char>(__lhs) | static_cast<unsigned char>(__rhs)); }
+constexpr byte operator| (byte __lhs, byte __rhs) noexcept
+{ return byte(static_cast<unsigned char>(__lhs) | static_cast<unsigned char>(__rhs)); }
+
+constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept
+{ return __lhs = byte(static_cast<unsigned char>(__lhs) & static_cast<unsigned char>(__rhs)); }
+constexpr byte operator& (byte __lhs, byte __rhs) noexcept
+{ return byte(static_cast<unsigned char>(__lhs) & static_cast<unsigned char>(__rhs)); }
+
+constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept
+{ return __lhs = byte(static_cast<unsigned char>(__lhs) ^ static_cast<unsigned char>(__rhs)); }
+constexpr byte operator^ (byte __lhs, byte __rhs) noexcept
+{ return byte(static_cast<unsigned char>(__lhs) ^ static_cast<unsigned char>(__rhs)); }
+
+constexpr byte operator~ (byte __b) noexcept
+{ return byte(~static_cast<unsigned char>(__b)); }
+
+}
+
+#include <type_traits> // rest of byte
+#endif
+
#endif // _LIBCPP_CSTDDEF
OpenPOWER on IntegriCloud