mirror of
				https://github.com/vsariola/sointu.git
				synced 2025-10-31 07:54:26 -04:00 
			
		
		
		
	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:
		| @ -94,12 +94,8 @@ func (r *SongRect) Contains(p SongPoint) bool { | ||||
| } | ||||
|  | ||||
| func mod(a, b int) int { | ||||
| 	m := a % b | ||||
| 	if a < 0 && b < 0 { | ||||
| 		m -= b | ||||
| 	if a < 0 { | ||||
| 		return b - 1 - mod(-a-1, b) | ||||
| 	} | ||||
| 	if a < 0 && b > 0 { | ||||
| 		m += b | ||||
| 	} | ||||
| 	return m | ||||
| 	return a % b | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user