From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id F25FE3857C71; Thu, 8 Sep 2022 18:31:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F25FE3857C71 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662661865; bh=CiiyUce/XfnISQnhgPJizbRKFePAmhRRcU9rdP8Qen4=; h=From:To:Subject:Date:From; b=Mvxdlpo26tbJBqRvFKU+Dib7IqEBbeEEDNJzbVlyF7UI4Hl66+Mv1u4k7j9h7HL6w MEFGeGRvp9f9SaeBq4awLzovzLe/Sr6MBVxssXg1CXhKrynSIdEtesZEekAUsTK1Cq eA2JkqBUHwoTc3ZdWclv5XXHS8xsgwYMDozyZ6WA= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-2549] libstdc++: Add always_inline attribute to std::byte operators X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 157236dbd621644b3cec50b6cf38811959f3e78c X-Git-Newrev: 4977507e329ee3ed410fc7338b9aaada81b68361 Message-Id: <20220908183105.F25FE3857C71@sourceware.org> Date: Thu, 8 Sep 2022 18:31:05 +0000 (GMT) List-Id: https://gcc.gnu.org/g:4977507e329ee3ed410fc7338b9aaada81b68361 commit r13-2549-g4977507e329ee3ed410fc7338b9aaada81b68361 Author: Jonathan Wakely Date: Thu Sep 8 13:46:02 2022 +0100 libstdc++: Add always_inline attribute to std::byte operators libstdc++-v3/ChangeLog: * include/c_global/cstddef (byte): Add always_inline attribute to all operator overloads. (to_integer): Add always_inline attribute. Diff: --- libstdc++-v3/include/c_global/cstddef | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/c_global/cstddef b/libstdc++-v3/include/c_global/cstddef index 4970c2dfcfb..df2d88a2ce5 100644 --- a/libstdc++-v3/include/c_global/cstddef +++ b/libstdc++-v3/include/c_global/cstddef @@ -119,55 +119,66 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION using __byte_op_t = typename __byte_operand<_IntegerType>::__type; template + [[__gnu__::__always_inline__]] constexpr __byte_op_t<_IntegerType> operator<<(byte __b, _IntegerType __shift) noexcept { return (byte)(unsigned char)((unsigned)__b << __shift); } template + [[__gnu__::__always_inline__]] constexpr __byte_op_t<_IntegerType> operator>>(byte __b, _IntegerType __shift) noexcept { return (byte)(unsigned char)((unsigned)__b >> __shift); } + [[__gnu__::__always_inline__]] constexpr byte operator|(byte __l, byte __r) noexcept { return (byte)(unsigned char)((unsigned)__l | (unsigned)__r); } + [[__gnu__::__always_inline__]] constexpr byte operator&(byte __l, byte __r) noexcept { return (byte)(unsigned char)((unsigned)__l & (unsigned)__r); } + [[__gnu__::__always_inline__]] constexpr byte operator^(byte __l, byte __r) noexcept { return (byte)(unsigned char)((unsigned)__l ^ (unsigned)__r); } + [[__gnu__::__always_inline__]] constexpr byte operator~(byte __b) noexcept { return (byte)(unsigned char)~(unsigned)__b; } template + [[__gnu__::__always_inline__]] constexpr __byte_op_t<_IntegerType>& operator<<=(byte& __b, _IntegerType __shift) noexcept { return __b = __b << __shift; } template + [[__gnu__::__always_inline__]] constexpr __byte_op_t<_IntegerType>& operator>>=(byte& __b, _IntegerType __shift) noexcept { return __b = __b >> __shift; } + [[__gnu__::__always_inline__]] constexpr byte& operator|=(byte& __l, byte __r) noexcept { return __l = __l | __r; } + [[__gnu__::__always_inline__]] constexpr byte& operator&=(byte& __l, byte __r) noexcept { return __l = __l & __r; } + [[__gnu__::__always_inline__]] constexpr byte& operator^=(byte& __l, byte __r) noexcept { return __l = __l ^ __r; } template - [[nodiscard]] + [[nodiscard,__gnu__::__always_inline__]] constexpr _IntegerType to_integer(__byte_op_t<_IntegerType> __b) noexcept { return _IntegerType(__b); }