2 //===--------------------------- cstddef ----------------------------------===//
4 // The LLVM Compiler Infrastructure
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 #ifndef _LIBCPP_CSTDDEF
12 #define _LIBCPP_CSTDDEF
19 offsetof(type,member-designator)
40 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
41 #pragma GCC system_header
44 // Don't include our own <stddef.h>; we don't want to declare ::nullptr_t.
45 #include_next <stddef.h>
48 _LIBCPP_BEGIN_NAMESPACE_STD
53 #if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \
54 defined(__DEFINED_max_align_t) || defined(__NetBSD__)
55 // Re-use the compiler's <stddef.h> max_align_t where possible.
58 typedef long double max_align_t;
61 _LIBCPP_END_NAMESPACE_STD
63 #if _LIBCPP_STD_VER > 14
64 namespace std // purposefully not versioned
66 enum class byte : unsigned char {};
68 constexpr byte operator| (byte __lhs, byte __rhs) noexcept
70 return static_cast<byte>(
71 static_cast<unsigned char>(
72 static_cast<unsigned int>(__lhs) | static_cast<unsigned int>(__rhs)
76 constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept
77 { return __lhs = __lhs | __rhs; }
79 constexpr byte operator& (byte __lhs, byte __rhs) noexcept
81 return static_cast<byte>(
82 static_cast<unsigned char>(
83 static_cast<unsigned int>(__lhs) & static_cast<unsigned int>(__rhs)
87 constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept
88 { return __lhs = __lhs & __rhs; }
90 constexpr byte operator^ (byte __lhs, byte __rhs) noexcept
92 return static_cast<byte>(
93 static_cast<unsigned char>(
94 static_cast<unsigned int>(__lhs) ^ static_cast<unsigned int>(__rhs)
98 constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept
99 { return __lhs = __lhs ^ __rhs; }
101 constexpr byte operator~ (byte __b) noexcept
103 return static_cast<byte>(
104 static_cast<unsigned char>(
105 ~static_cast<unsigned int>(__b)
111 #include <type_traits> // rest of byte
114 #endif // _LIBCPP_CSTDDEF