mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-27 06:47:13 +00:00
ensure HashList/HashArray maxChunks power of 2 in int64 (#2394)
This commit is contained in:
parent
74a75d05a0
commit
236a9cdd1d
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2018-2020 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
@ -168,6 +168,7 @@ template maxChunks*(a: HashList|HashArray): int64 =
|
||||
|
||||
template maxDepth*(a: HashList|HashArray): int =
|
||||
## Layer where data is
|
||||
static: doAssert a.maxChunks <= high(int64) div 2
|
||||
layer(nextPow2(a.maxChunks.uint64).int64)
|
||||
|
||||
template chunkIdx(a: HashList|HashArray, dataIdx: int64): int64 =
|
||||
|
Loading…
x
Reference in New Issue
Block a user