Fix typo in big.internal_invmod

Fixes #3253
This commit is contained in:
Jeroen van Rijn
2024-03-08 18:05:34 +01:00
parent 0e168dd292
commit db03c86544
2 changed files with 3359 additions and 3416 deletions
+5 -15
View File
@@ -1181,28 +1181,18 @@ internal_cmp_digit :: internal_compare_digit
*/
internal_int_compare_magnitude :: #force_inline proc(a, b: ^Int) -> (comparison: int) {
assert_if_nil(a, b)
/*
Compare based on used digits.
*/
// Compare based on used digits.
if a.used != b.used {
if a.used > b.used {
return +1
}
return -1
return +1 if a.used > b.used else -1
}
/*
Same number of used digits, compare based on their value.
*/
// Same number of used digits, compare based on their value.
#no_bounds_check for n := a.used - 1; n >= 0; n -= 1 {
if a.digit[n] != b.digit[n] {
if a.digit[n] > b.digit[n] {
return +1
}
return -1
return +1 if a.digit[n] > b.digit[n] else -1
}
}
return 0
}
internal_compare_magnitude :: proc { internal_int_compare_magnitude, }
+3354 -3401
View File
File diff suppressed because it is too large Load Diff