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)
39 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
40 #pragma GCC system_header
43 // Don't include our own <stddef.h>; we don't want to declare ::nullptr_t.
44 #include_next <stddef.h>
47 _LIBCPP_BEGIN_NAMESPACE_STD
52 #if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \
53 defined(__DEFINED_max_align_t)
54 // Re-use the compiler's <stddef.h> max_align_t where possible.
57 typedef long double max_align_t;
60 _LIBCPP_END_NAMESPACE_STD
62 #if _LIBCPP_STD_VER > 14
63 namespace std // purposefully not versioned
65 enum class byte : unsigned char {};
67 constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept
68 { return __lhs = byte(static_cast<unsigned char>(__lhs) | static_cast<unsigned char>(__rhs)); }
69 constexpr byte operator| (byte __lhs, byte __rhs) noexcept
70 { return byte(static_cast<unsigned char>(__lhs) | static_cast<unsigned char>(__rhs)); }
72 constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept
73 { return __lhs = byte(static_cast<unsigned char>(__lhs) & static_cast<unsigned char>(__rhs)); }
74 constexpr byte operator& (byte __lhs, byte __rhs) noexcept
75 { return byte(static_cast<unsigned char>(__lhs) & static_cast<unsigned char>(__rhs)); }
77 constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept
78 { return __lhs = byte(static_cast<unsigned char>(__lhs) ^ static_cast<unsigned char>(__rhs)); }
79 constexpr byte operator^ (byte __lhs, byte __rhs) noexcept
80 { return byte(static_cast<unsigned char>(__lhs) ^ static_cast<unsigned char>(__rhs)); }
82 constexpr byte operator~ (byte __b) noexcept
83 { return byte(~static_cast<unsigned char>(__b)); }
87 #include <type_traits> // rest of byte
90 #endif // _LIBCPP_CSTDDEF