Skip to content

Commit 7a40399

Browse files
committed
Fix uint256_mul_div_mod bug.
1 parent 44dae41 commit 7a40399

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

vm/src/hint_processor/builtin_hint_processor/uint256_utils.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,10 @@ pub fn uint256_mul_div_mod(
431431
let div_high = div_high.as_ref();
432432

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

439439
// ids.quotient_low.low
440440
vm.insert_value(

0 commit comments

Comments
 (0)