chore(parser/diff): faster pyMod
This commit is contained in:
parent
2f94bd30ed
commit
7e61f8ae7d
|
@ -121,11 +121,7 @@ func diffInternal(e, f []any, equals func(any, any) bool, i, j int) []Op {
|
||||||
* See https://en.wikipedia.org/wiki/Modulo_operation#Variants_of_the_definition
|
* See https://en.wikipedia.org/wiki/Modulo_operation#Variants_of_the_definition
|
||||||
*/
|
*/
|
||||||
func pyMod(x, y int) int {
|
func pyMod(x, y int) int {
|
||||||
mod := x % y
|
return (x%y + y) % y
|
||||||
if mod < 0 {
|
|
||||||
mod += y
|
|
||||||
}
|
|
||||||
return mod
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let us map element in same way as in
|
// Let us map element in same way as in
|
||||||
|
|
Loading…
Reference in New Issue
Block a user