public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r13-2549] libstdc++: Add always_inline attribute to std::byte operators
Date: Thu,  8 Sep 2022 18:31:05 +0000 (GMT)	[thread overview]
Message-ID: <20220908183105.F25FE3857C71@sourceware.org> (raw)

https://gcc.gnu.org/g:4977507e329ee3ed410fc7338b9aaada81b68361

commit r13-2549-g4977507e329ee3ed410fc7338b9aaada81b68361
Author: Jonathan Wakely <jwakely@redhat.com>
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<typename _IntegerType>
+    [[__gnu__::__always_inline__]]
     constexpr __byte_op_t<_IntegerType>
     operator<<(byte __b, _IntegerType __shift) noexcept
     { return (byte)(unsigned char)((unsigned)__b << __shift); }
 
   template<typename _IntegerType>
+    [[__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<typename _IntegerType>
+    [[__gnu__::__always_inline__]]
     constexpr __byte_op_t<_IntegerType>&
     operator<<=(byte& __b, _IntegerType __shift) noexcept
     { return __b = __b << __shift; }
 
   template<typename _IntegerType>
+    [[__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<typename _IntegerType>
-    [[nodiscard]]
+    [[nodiscard,__gnu__::__always_inline__]]
     constexpr _IntegerType
     to_integer(__byte_op_t<_IntegerType> __b) noexcept
     { return _IntegerType(__b); }

                 reply	other threads:[~2022-09-08 18:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220908183105.F25FE3857C71@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).