16 lines
209 B
Go
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)
|
||
|
}
|
||
|
}
|