Use the `get_previous_power_of_2` function in ethereum/eth2.0-specs#1323

This commit is contained in:
Hsiao-Wei Wang 2019-08-15 16:14:07 +08:00
parent d88a83d482
commit 0f52d460a5
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
1 changed files with 1 additions and 2 deletions

View File

@ -50,8 +50,7 @@ def get_previous_power_of_two(x: int) -> int:
""" """
Get the previous power of 2 >= the input. Get the previous power of 2 >= the input.
""" """
assert x >= 2 return x if x <= 2 else 2 * get_previous_power_of_2(x // 2)
return get_next_power_of_two(x) // 2
``` ```
## Generalized Merkle tree index ## Generalized Merkle tree index