diff --git a/include/fixmath/fixed_impl.inl b/include/fixmath/fixed_impl.inl index 5c50d74..b965a65 100644 --- a/include/fixmath/fixed_impl.inl +++ b/include/fixmath/fixed_impl.inl @@ -294,9 +294,9 @@ constexpr fixed operator/(fixed a, fixed b) { int64_t rem = 0; if constexpr (sizeof(raw_t) == 8) { // use extended int128 division - raw_t _check_bits = a.raw() >> (fixed::ALL_BITS - fixed::FRACTION_BITS - 1); - raw_t _remain_bits = a.raw() & (fixed::FRACTION_MASK >> 1); - if (FIXMATH_LIKELY(_check_bits == 0 || (_check_bits == -1 && _remain_bits))) { + const static raw_t _simp_min = fixed::INTEGER_MASK >> 1; + const static raw_t _simp_max = fixed::FRACTION_MASK >> 1; + if (FIXMATH_LIKELY(_simp_min < a.raw() && a.raw() <= _simp_max)) { // check for simplified division qlo = a.raw() * fixed::RATIO; if constexpr (policy::rounding) {