mirror of
https://github.com/logos-storage/nim-poseidon2.git
synced 2026-01-08 00:23:11 +00:00
Remove if statement at compile time
This commit is contained in:
parent
3c8486f73c
commit
aef3b060bb
@ -15,10 +15,10 @@ func merkleRoot(xs: openArray[F], isBottomLayer: static bool) : F =
|
||||
let b = high(xs)
|
||||
let m = b-a+1
|
||||
|
||||
if m==1 and not isBottomLayer:
|
||||
when not isBottomLayer:
|
||||
if m==1:
|
||||
return xs[a]
|
||||
|
||||
else:
|
||||
let halfn : int = m div 2
|
||||
let n : int = 2*halfn
|
||||
let isOdd : bool = (n != m)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user