mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-08 00:13:08 +00:00
missing avg function for int
This commit is contained in:
parent
d95ff2f73d
commit
e3dd68a13d
@ -22,6 +22,11 @@ func avg(vals: openArray[float]): float =
|
||||
for v in vals:
|
||||
result += v / vals.len().toFloat()
|
||||
|
||||
func avg(vals: openArray[int]): int =
|
||||
for v in vals:
|
||||
result += v
|
||||
result = result div vals.len()
|
||||
|
||||
template benchmark*(name: untyped, count: int, blk: untyped) =
|
||||
let benchmarkName: string = name
|
||||
## simple benchmarking of a block of code
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user