Skip to content

Commit 209a057

Browse files
committed
Try divmod workaround
1 parent 8348957 commit 209a057

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/boost/decimal/detail/fenv_rounding.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,19 @@ constexpr auto divmod(T dividend, T divisor) noexcept -> divmod_result<T>
4545
template <typename T, std::enable_if_t<!std::is_integral<T>::value, bool> = true>
4646
constexpr auto divmod(T dividend, T divisor) noexcept -> divmod_result<T>
4747
{
48+
#ifndef __i386__
49+
4850
T q {dividend / divisor};
4951
T r {dividend - q * divisor};
5052
return {q, r};
53+
54+
#else
55+
56+
const auto q {static_cast<T>(dividend / divisor)};
57+
const auto r {static_cast<T>(dividend % divisor)};
58+
return {q, r};
59+
60+
#endif
5161
}
5262

5363
#ifdef BOOST_DECIMAL_DETAIL_INT128_HAS_INT128

0 commit comments

Comments
 (0)