mirror of
https://github.com/boostorg/multiprecision.git
synced 2026-02-20 14:52:24 +00:00
Fix sign of division in cpp_int when the values are small enough to fit in a double_limb_type.
Add test cases for above. Fixes #8126. [SVN r83060]
This commit is contained in:
@@ -114,7 +114,10 @@ void divide_unsigned_helper(
|
||||
if(r_order == 0)
|
||||
{
|
||||
if(result)
|
||||
{
|
||||
*result = px[0] / py[0];
|
||||
result->sign(x.sign() != y.sign());
|
||||
}
|
||||
r = px[0] % py[0];
|
||||
return;
|
||||
}
|
||||
@@ -126,7 +129,10 @@ void divide_unsigned_helper(
|
||||
(static_cast<double_limb_type>(py[1]) << CppInt1::limb_bits) | py[0]
|
||||
: py[0];
|
||||
if(result)
|
||||
{
|
||||
*result = a / b;
|
||||
result->sign(x.sign() != y.sign());
|
||||
}
|
||||
r = a % b;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user