diff --git a/include/boost/system/detail/error_code.hpp b/include/boost/system/detail/error_code.hpp index eaf4324..910a9af 100644 --- a/include/boost/system/detail/error_code.hpp +++ b/include/boost/system/detail/error_code.hpp @@ -188,7 +188,11 @@ public: #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) std::error_code const& ec = *reinterpret_cast( d2_ ); - return ec.value() + 1000 * static_cast( reinterpret_cast( &ec.category() ) % 2097143 ); // 2^21-9, prime + + unsigned cv = static_cast( ec.value() ); + unsigned ch = static_cast( reinterpret_cast( &ec.category() ) % 2097143 ); // 2^21-9, prime + + return static_cast( cv + 1000 * ch ); #else return -1;