`ceillog2` accepts positive integers now

This commit is contained in:
ericsson 2020-09-01 11:07:44 +03:00
parent 6df35fc3b5
commit a380f3e1b1
1 changed files with 3 additions and 1 deletions

View File

@ -152,7 +152,9 @@ GeneralizedIndex = NewType('GeneralizedIndex', int)
SSZObject = TypeVar('SSZObject', bound=View)
'''
SUNDRY_CONSTANTS_FUNCTIONS = '''
def ceillog2(x: uint64) -> uint64:
def ceillog2(x: int) -> uint64:
if x < 1:
raise ValueError(f"ceillog2 accepts only positive values, x={x}")
return uint64((x - 1).bit_length())
'''
PHASE0_SUNDRY_FUNCTIONS = '''