mirror of
https://github.com/ethereum/consensus-specs.git
synced 2026-02-02 08:24:55 -05:00
Use the get_previous_power_of_2 function in ethereum/eth2.0-specs#1323
This commit is contained in:
@@ -50,8 +50,7 @@ def get_previous_power_of_two(x: int) -> int:
|
||||
"""
|
||||
Get the previous power of 2 >= the input.
|
||||
"""
|
||||
assert x >= 2
|
||||
return get_next_power_of_two(x) // 2
|
||||
return x if x <= 2 else 2 * get_previous_power_of_2(x // 2)
|
||||
```
|
||||
|
||||
## Generalized Merkle tree index
|
||||
|
||||
Reference in New Issue
Block a user