From 6c7edac9b1c89718c6f97fada470fd1045753fa6 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Tue, 30 May 2023 04:32:23 +0300 Subject: [PATCH] Fix 32 bit constexpr failures --- include/boost/core/bit.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/boost/core/bit.hpp b/include/boost/core/bit.hpp index 6029ba5..5612f71 100644 --- a/include/boost/core/bit.hpp +++ b/include/boost/core/bit.hpp @@ -241,6 +241,15 @@ inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT } } +#elif defined(_MSC_VER) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL) + +BOOST_CXX14_CONSTEXPR inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT +{ + return static_cast( x >> 32 ) != 0? + boost::core::detail::countl_impl( static_cast( x >> 32 ) ): + boost::core::detail::countl_impl( static_cast( x ) ) + 32; +} + #else inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT @@ -457,6 +466,15 @@ inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT } } +#elif defined(_MSC_VER) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL) + +BOOST_CXX14_CONSTEXPR inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT +{ + return static_cast( x ) != 0? + boost::core::detail::countr_impl( static_cast( x ) ): + boost::core::detail::countr_impl( static_cast( x >> 32 ) ) + 32; +} + #else inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT