Skip to content

Commit f9c3bdc

Browse files
Handle overflows
Thanks @koba-e964 again! Co-authored-by: Hiroki Kobayashi <[email protected]>
1 parent b284f6d commit f9c3bdc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/internal_math.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl Barrett {
3131
fn new(m: u32) -> Barrett {
3232
Barrett {
3333
_m: m,
34-
im: (-1i64 as u64) / (m as u64) + 1,
34+
im: (-1i64 as u64 / m as u64).wrapping_add(1),
3535
}
3636
}
3737

0 commit comments

Comments
 (0)