diff options
-rw-r--r-- | basebmp/inc/metafunctions.hxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/basebmp/inc/metafunctions.hxx b/basebmp/inc/metafunctions.hxx index 4e6efb44413f..4c35f3b801d0 100644 --- a/basebmp/inc/metafunctions.hxx +++ b/basebmp/inc/metafunctions.hxx @@ -214,10 +214,11 @@ template< typename T > inline T shiftRight( T v, int shift ) static_assert( std::is_unsigned<T>::value, "must be unsigned for promotedBits and the below ': 0' to be correct"); - auto const promotedBits = std::numeric_limits<decltype(+T())>::digits; + using Promoted = decltype(+T()); + auto const promotedBits = std::numeric_limits<Promoted>::digits; return shift >= 0 - ? shift < promotedBits ? v >> shift : 0 - : -shift < promotedBits ? v << (-shift) : 0; + ? shift < promotedBits ? Promoted(v) >> shift : 0 + : -shift < promotedBits ? Promoted(v) << (-shift) : 0; } } // namespace basebmp |