mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-30 03:10:06 +00:00
For invmod, b has to be > 1, fix a logic typo
This commit is contained in:
@@ -2046,9 +2046,9 @@ internal_int_inverse_modulo :: proc(dest, a, b: ^Int, allocator := context.alloc
|
|||||||
if internal_is_positive(a) && internal_eq(b, 1) { return internal_zero(dest) }
|
if internal_is_positive(a) && internal_eq(b, 1) { return internal_zero(dest) }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
`b` cannot be negative and has to be > 1
|
`b` cannot be negative and b has to be > 1
|
||||||
*/
|
*/
|
||||||
if internal_is_negative(b) || internal_gt(b, 1) { return .Invalid_Argument }
|
if internal_is_negative(b) || !internal_gt(b, 1) { return .Invalid_Argument }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If the modulus is odd we can use a faster routine instead.
|
If the modulus is odd we can use a faster routine instead.
|
||||||
@@ -2954,4 +2954,4 @@ internal_zero_unused :: proc { internal_int_zero_unused, }
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
========================== End of low-level routines ==========================
|
========================== End of low-level routines ==========================
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user