public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-10774] libstdc++: Add always_inline attribute to std::byte operators
@ 2023-05-16 12:50 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2023-05-16 12:50 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:29cc830367656d7d3582dd2164a8db9ad66f9187
commit r11-10774-g29cc830367656d7d3582dd2164a8db9ad66f9187
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.
(cherry picked from commit 4977507e329ee3ed410fc7338b9aaada81b68361)
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 13ef7f03c12..58bbdf66be9 100644
--- a/libstdc++-v3/include/c_global/cstddef
+++ b/libstdc++-v3/include/c_global/cstddef
@@ -121,55 +121,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); }
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-16 12:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-16 12:50 [gcc r11-10774] libstdc++: Add always_inline attribute to std::byte operators Jonathan Wakely
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).