ds/utils.go
2023-07-10 17:16:51 +02:00

16 lines
209 B
Go

package ds
func modAbs(a, b int) int {
v := a % b
if v < 0 {
return b + v
}
return v
}
func preAllocList[T any, L List[T]](list L, value T, size int) {
for list.Size() < size {
list.Add(value)
}
}