Skip to content

Commit

Permalink
Fix uint256_mul_div_mod bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
alonh5 committed Jul 10, 2023
1 parent 44dae41 commit 7a40399
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vm/src/hint_processor/builtin_hint_processor/uint256_utils.rs
Expand Up @@ -431,10 +431,10 @@ pub fn uint256_mul_div_mod(
let div_high = div_high.as_ref();

// Main Logic
let a = a_high.shl(128_usize) + a_low;
let b = b_high.shl(128_usize) + b_low;
let div = div_high.shl(128_usize) + div_low;
let (quotient, remainder) = (a.to_biguint() * b.to_biguint()).div_mod_floor(&div.to_biguint());
let a = a_high.to_biguint().shl(128_usize) + a_low.to_biguint();
let b = b_high.to_biguint().shl(128_usize) + b_low.to_biguint();
let div = div_high.to_biguint().shl(128_usize) + div_low.to_biguint();
let (quotient, remainder) = (a * b).div_mod_floor(&div);

// ids.quotient_low.low
vm.insert_value(
Expand Down

0 comments on commit 7a40399

Please sign in to comment.