From 3b70265ced04565f9410e3a766c24d36b7bd11cf Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 15 Sep 2021 16:42:47 +0300 Subject: [PATCH] Rearrange error_code::failed to improve codegen --- include/boost/system/detail/error_code.hpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/include/boost/system/detail/error_code.hpp b/include/boost/system/detail/error_code.hpp index 45833eb..5cba48d 100644 --- a/include/boost/system/detail/error_code.hpp +++ b/include/boost/system/detail/error_code.hpp @@ -230,18 +230,20 @@ public: BOOST_SYSTEM_CONSTEXPR bool failed() const BOOST_NOEXCEPT { -#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) - - if( lc_flags_ == 1 ) + if( lc_flags_ & 1 ) { - std::error_code const& ec = *reinterpret_cast( d2_ ); - return ec.value() != 0; +#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + if( lc_flags_ == 1 ) + { + std::error_code const& ec = *reinterpret_cast( d2_ ); + return ec.value() != 0; + } +#endif + return true; } else - -#endif { - return (lc_flags_ & 1) != 0; + return false; } }