chore(parser/diff): faster pyMod
All checks were successful
submodules sync / sync (push) Successful in 39s
build / build (push) Successful in 2m0s
build / trigger-build-image (push) Successful in 11s

This commit is contained in:
张泊明518370910136 2025-03-26 20:48:09 -04:00
parent 2f94bd30ed
commit 7e61f8ae7d
GPG Key ID: D47306D7062CDA9D

View File

@ -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
*/
func pyMod(x, y int) int {
mod := x % y
if mod < 0 {
mod += y
}
return mod
return (x%y + y) % y
}
// Let us map element in same way as in