fix(tracker): the mod function could return negative values with mod(-1,1)

Never copy-paste code from the internets
This commit is contained in:
vsariola 2021-04-10 19:17:38 +03:00
parent d04895144b
commit 4ce6abe1e8

View File

@ -94,12 +94,8 @@ func (r *SongRect) Contains(p SongPoint) bool {
} }
func mod(a, b int) int { func mod(a, b int) int {
m := a % b if a < 0 {
if a < 0 && b < 0 { return b - 1 - mod(-a-1, b)
m -= b
} }
if a < 0 && b > 0 { return a % b
m += b
}
return m
} }