This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On 11/01/17 10:29 +0000, Jonathan Wakely wrote:
On 11/01/17 00:19 +0200, Ville Voutilainen wrote:@@ -1086,7 +1099,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return !this->_M_valid(); } constexpr size_t index() const noexcept - { return this->_M_index; } + { + if (this->_M_index == + typename _Base::_Storage::__index_type(variant_npos)) + return variant_npos; + return this->_M_index;GCC doesn't seem to be smart enough to optimize the branch away here.
But that's only for 32-bit x86. It optimizes well for x86_64, so no need to obfuscate it.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |