Skip to content

Commit

Permalink
fix: handle edge case in multiplication limb count
Browse files Browse the repository at this point in the history
  • Loading branch information
ivokub committed Nov 15, 2023
1 parent 2959a28 commit b2a3ecc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion std/math/emulated/hints.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ func (f *Field[T]) computeMultiplicationHint(leftLimbs, rightLimbs []frontend.Va
// nbMultiplicationResLimbs returns the number of limbs which fit the
// multiplication result.
func nbMultiplicationResLimbs(lenLeft, lenRight int) int {
return lenLeft + lenRight - 1
res := lenLeft + lenRight - 1
if res < 0 {
res = 0
}
return res
}

// MultiplicationHint unpacks the factors and parameters from inputs, computes
Expand Down

0 comments on commit b2a3ecc

Please sign in to comment.