mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Add tests and fixes for modpow2, muldivmod
This commit is contained in:
parent
cb31a20206
commit
703bcd6e32
10 changed files with 2017 additions and 54 deletions
|
@ -128,12 +128,10 @@ RefInt256 muldiv(RefInt256 x, RefInt256 y, RefInt256 z, int round_mode) {
|
|||
}
|
||||
|
||||
std::pair<RefInt256, RefInt256> muldivmod(RefInt256 x, RefInt256 y, RefInt256 z, int round_mode) {
|
||||
typename td::BigInt256::DoubleInt tmp{0};
|
||||
typename td::BigInt256::DoubleInt tmp{0}, quot;
|
||||
tmp.add_mul(*x, *y);
|
||||
RefInt256 quot{true};
|
||||
tmp.mod_div(*z, quot.unique_write(), round_mode);
|
||||
quot.write().normalize();
|
||||
return std::make_pair(std::move(quot), td::make_refint(tmp));
|
||||
tmp.mod_div(*z, quot, round_mode);
|
||||
return std::make_pair(td::make_refint(quot.normalize()), td::make_refint(tmp));
|
||||
}
|
||||
|
||||
RefInt256 operator&(RefInt256 x, RefInt256 y) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue