mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-30 21:28:59 +00:00
AK: Use correct wide integer type for qhat check in UFixedBigIntDivision
Previously, we were assuming that were always on a 64-bit platform, which is not 100% correct
This commit is contained in:
parent
f95abe8c0e
commit
9045840e33
Notes:
sideshowbarker
2024-07-17 00:16:31 +09:00
Author: https://github.com/Hendiadyoin1
Commit: 9045840e33
Pull-request: https://github.com/SerenityOS/serenity/pull/23619
Issue: https://github.com/SerenityOS/serenity/issues/23575
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/DanShaders ✅
1 changed files with 1 additions and 1 deletions
|
@ -95,7 +95,7 @@ constexpr void div_mod_internal(
|
||||||
qhat = div_mod_words(dividend[i - 1], dividend[i], divisor_approx, rhat);
|
qhat = div_mod_words(dividend[i - 1], dividend[i], divisor_approx, rhat);
|
||||||
|
|
||||||
auto is_qhat_too_large = [&] {
|
auto is_qhat_too_large = [&] {
|
||||||
return UFixedBigInt<native_word_size> { qhat }.wide_multiply(divisor[divisor_len - 2]) > u128 { dividend[i - 2], rhat };
|
return UFixedBigInt<native_word_size> { qhat }.wide_multiply(divisor[divisor_len - 2]) > UFixedBigInt<native_word_size * 2> { dividend[i - 2], rhat };
|
||||||
};
|
};
|
||||||
if (is_qhat_too_large()) {
|
if (is_qhat_too_large()) {
|
||||||
--qhat;
|
--qhat;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue