163d1a8abSmrg// -*- C++ -*- forwarding header. 263d1a8abSmrg 3*ec02198aSmrg// Copyright (C) 1997-2020 Free Software Foundation, Inc. 463d1a8abSmrg// 563d1a8abSmrg// This file is part of the GNU ISO C++ Library. This library is free 663d1a8abSmrg// software; you can redistribute it and/or modify it under the 763d1a8abSmrg// terms of the GNU General Public License as published by the 863d1a8abSmrg// Free Software Foundation; either version 3, or (at your option) 963d1a8abSmrg// any later version. 1063d1a8abSmrg 1163d1a8abSmrg// This library is distributed in the hope that it will be useful, 1263d1a8abSmrg// but WITHOUT ANY WARRANTY; without even the implied warranty of 1363d1a8abSmrg// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1463d1a8abSmrg// GNU General Public License for more details. 1563d1a8abSmrg 1663d1a8abSmrg// Under Section 7 of GPL version 3, you are granted additional 1763d1a8abSmrg// permissions described in the GCC Runtime Library Exception, version 1863d1a8abSmrg// 3.1, as published by the Free Software Foundation. 1963d1a8abSmrg 2063d1a8abSmrg// You should have received a copy of the GNU General Public License and 2163d1a8abSmrg// a copy of the GCC Runtime Library Exception along with this program; 2263d1a8abSmrg// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 2363d1a8abSmrg// <http://www.gnu.org/licenses/>. 2463d1a8abSmrg 2563d1a8abSmrg/** @file cstddef 2663d1a8abSmrg * This is a Standard C++ Library file. You should @c \#include this file 2763d1a8abSmrg * in your programs, rather than any of the @a *.h implementation files. 2863d1a8abSmrg * 2963d1a8abSmrg * This is the C++ version of the Standard C Library header @c stddef.h, 3063d1a8abSmrg * and its contents are (mostly) the same as that header, but are all 3163d1a8abSmrg * contained in the namespace @c std (except for names which are defined 3263d1a8abSmrg * as macros in C). 3363d1a8abSmrg */ 3463d1a8abSmrg 3563d1a8abSmrg// 3663d1a8abSmrg// ISO C++ 14882: 18.1 Types 3763d1a8abSmrg// 3863d1a8abSmrg 3963d1a8abSmrg#ifndef _GLIBCXX_CSTDDEF 4063d1a8abSmrg#define _GLIBCXX_CSTDDEF 1 4163d1a8abSmrg 4263d1a8abSmrg#pragma GCC system_header 4363d1a8abSmrg 4463d1a8abSmrg#undef __need_wchar_t 4563d1a8abSmrg#undef __need_ptrdiff_t 4663d1a8abSmrg#undef __need_size_t 4763d1a8abSmrg#undef __need_NULL 4863d1a8abSmrg#undef __need_wint_t 4963d1a8abSmrg#include <bits/c++config.h> 5063d1a8abSmrg#include <stddef.h> 5163d1a8abSmrg 520fc04c29Smrgextern "C++" 530fc04c29Smrg{ 5463d1a8abSmrg#if __cplusplus >= 201103L 5563d1a8abSmrgnamespace std 5663d1a8abSmrg{ 5763d1a8abSmrg // We handle size_t, ptrdiff_t, and nullptr_t in c++config.h. 5863d1a8abSmrg using ::max_align_t; 5963d1a8abSmrg} 600fc04c29Smrg#endif // C++11 6163d1a8abSmrg 6263d1a8abSmrg#if __cplusplus >= 201703L 6363d1a8abSmrgnamespace std 6463d1a8abSmrg{ 650fc04c29Smrg_GLIBCXX_BEGIN_NAMESPACE_VERSION 6663d1a8abSmrg#define __cpp_lib_byte 201603 6763d1a8abSmrg 6863d1a8abSmrg /// std::byte 6963d1a8abSmrg enum class byte : unsigned char {}; 7063d1a8abSmrg 7163d1a8abSmrg template<typename _IntegerType> struct __byte_operand { }; 7263d1a8abSmrg template<> struct __byte_operand<bool> { using __type = byte; }; 7363d1a8abSmrg template<> struct __byte_operand<char> { using __type = byte; }; 7463d1a8abSmrg template<> struct __byte_operand<signed char> { using __type = byte; }; 7563d1a8abSmrg template<> struct __byte_operand<unsigned char> { using __type = byte; }; 7663d1a8abSmrg#ifdef _GLIBCXX_USE_WCHAR_T 7763d1a8abSmrg template<> struct __byte_operand<wchar_t> { using __type = byte; }; 7863d1a8abSmrg#endif 790fc04c29Smrg#ifdef _GLIBCXX_USE_CHAR8_T 800fc04c29Smrg template<> struct __byte_operand<char8_t> { using __type = byte; }; 810fc04c29Smrg#endif 8263d1a8abSmrg template<> struct __byte_operand<char16_t> { using __type = byte; }; 8363d1a8abSmrg template<> struct __byte_operand<char32_t> { using __type = byte; }; 8463d1a8abSmrg template<> struct __byte_operand<short> { using __type = byte; }; 8563d1a8abSmrg template<> struct __byte_operand<unsigned short> { using __type = byte; }; 8663d1a8abSmrg template<> struct __byte_operand<int> { using __type = byte; }; 8763d1a8abSmrg template<> struct __byte_operand<unsigned int> { using __type = byte; }; 8863d1a8abSmrg template<> struct __byte_operand<long> { using __type = byte; }; 8963d1a8abSmrg template<> struct __byte_operand<unsigned long> { using __type = byte; }; 9063d1a8abSmrg template<> struct __byte_operand<long long> { using __type = byte; }; 9163d1a8abSmrg template<> struct __byte_operand<unsigned long long> { using __type = byte; }; 9263d1a8abSmrg#if defined(__GLIBCXX_TYPE_INT_N_0) 9363d1a8abSmrg template<> struct __byte_operand<__GLIBCXX_TYPE_INT_N_0> 9463d1a8abSmrg { using __type = byte; }; 9563d1a8abSmrg template<> struct __byte_operand<unsigned __GLIBCXX_TYPE_INT_N_0> 9663d1a8abSmrg { using __type = byte; }; 9763d1a8abSmrg#endif 9863d1a8abSmrg#if defined(__GLIBCXX_TYPE_INT_N_1) 9963d1a8abSmrg template<> struct __byte_operand<__GLIBCXX_TYPE_INT_N_1> 10063d1a8abSmrg { using __type = byte; }; 10163d1a8abSmrg template<> struct __byte_operand<unsigned __GLIBCXX_TYPE_INT_N_1> 10263d1a8abSmrg { using __type = byte; }; 10363d1a8abSmrg#endif 10463d1a8abSmrg#if defined(__GLIBCXX_TYPE_INT_N_2) 10563d1a8abSmrg template<> struct __byte_operand<__GLIBCXX_TYPE_INT_N_2> 10663d1a8abSmrg { using __type = byte; }; 10763d1a8abSmrg template<> struct __byte_operand<unsigned __GLIBCXX_TYPE_INT_N_2> 10863d1a8abSmrg { using __type = byte; }; 10963d1a8abSmrg#endif 11063d1a8abSmrg template<typename _IntegerType> 11163d1a8abSmrg struct __byte_operand<const _IntegerType> 11263d1a8abSmrg : __byte_operand<_IntegerType> { }; 11363d1a8abSmrg template<typename _IntegerType> 11463d1a8abSmrg struct __byte_operand<volatile _IntegerType> 11563d1a8abSmrg : __byte_operand<_IntegerType> { }; 11663d1a8abSmrg template<typename _IntegerType> 11763d1a8abSmrg struct __byte_operand<const volatile _IntegerType> 11863d1a8abSmrg : __byte_operand<_IntegerType> { }; 11963d1a8abSmrg 12063d1a8abSmrg template<typename _IntegerType> 12163d1a8abSmrg using __byte_op_t = typename __byte_operand<_IntegerType>::__type; 12263d1a8abSmrg 12363d1a8abSmrg template<typename _IntegerType> 12463d1a8abSmrg constexpr __byte_op_t<_IntegerType> 12563d1a8abSmrg operator<<(byte __b, _IntegerType __shift) noexcept 126*ec02198aSmrg { return (byte)(unsigned char)((unsigned)__b << __shift); } 12763d1a8abSmrg 12863d1a8abSmrg template<typename _IntegerType> 12963d1a8abSmrg constexpr __byte_op_t<_IntegerType> 13063d1a8abSmrg operator>>(byte __b, _IntegerType __shift) noexcept 131*ec02198aSmrg { return (byte)(unsigned char)((unsigned)__b >> __shift); } 13263d1a8abSmrg 13363d1a8abSmrg constexpr byte 13463d1a8abSmrg operator|(byte __l, byte __r) noexcept 135*ec02198aSmrg { return (byte)(unsigned char)((unsigned)__l | (unsigned)__r); } 13663d1a8abSmrg 13763d1a8abSmrg constexpr byte 13863d1a8abSmrg operator&(byte __l, byte __r) noexcept 139*ec02198aSmrg { return (byte)(unsigned char)((unsigned)__l & (unsigned)__r); } 14063d1a8abSmrg 14163d1a8abSmrg constexpr byte 14263d1a8abSmrg operator^(byte __l, byte __r) noexcept 143*ec02198aSmrg { return (byte)(unsigned char)((unsigned)__l ^ (unsigned)__r); } 14463d1a8abSmrg 14563d1a8abSmrg constexpr byte 14663d1a8abSmrg operator~(byte __b) noexcept 147*ec02198aSmrg { return (byte)(unsigned char)~(unsigned)__b; } 148*ec02198aSmrg 149*ec02198aSmrg template<typename _IntegerType> 150*ec02198aSmrg constexpr __byte_op_t<_IntegerType>& 151*ec02198aSmrg operator<<=(byte& __b, _IntegerType __shift) noexcept 152*ec02198aSmrg { return __b = __b << __shift; } 153*ec02198aSmrg 154*ec02198aSmrg template<typename _IntegerType> 155*ec02198aSmrg constexpr __byte_op_t<_IntegerType>& 156*ec02198aSmrg operator>>=(byte& __b, _IntegerType __shift) noexcept 157*ec02198aSmrg { return __b = __b >> __shift; } 158*ec02198aSmrg 159*ec02198aSmrg constexpr byte& 160*ec02198aSmrg operator|=(byte& __l, byte __r) noexcept 161*ec02198aSmrg { return __l = __l | __r; } 162*ec02198aSmrg 163*ec02198aSmrg constexpr byte& 164*ec02198aSmrg operator&=(byte& __l, byte __r) noexcept 165*ec02198aSmrg { return __l = __l & __r; } 166*ec02198aSmrg 167*ec02198aSmrg constexpr byte& 168*ec02198aSmrg operator^=(byte& __l, byte __r) noexcept 169*ec02198aSmrg { return __l = __l ^ __r; } 17063d1a8abSmrg 17163d1a8abSmrg template<typename _IntegerType> 17263d1a8abSmrg constexpr _IntegerType 17363d1a8abSmrg to_integer(__byte_op_t<_IntegerType> __b) noexcept 17463d1a8abSmrg { return _IntegerType(__b); } 17563d1a8abSmrg 1760fc04c29Smrg_GLIBCXX_END_NAMESPACE_VERSION 17763d1a8abSmrg} // namespace std 1780fc04c29Smrg#endif // C++17 1790fc04c29Smrg} // extern "C++" 18063d1a8abSmrg 18163d1a8abSmrg#endif // _GLIBCXX_CSTDDEF 182