mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-25 09:02:48 +00:00
Fix 0 limb size for value 0
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
This commit is contained in:
parent
e16a945421
commit
5ded38e0e1
@ -68,7 +68,8 @@ def bound_mpi_limbs(limbs: int, bits_in_limb: int) -> int:
|
|||||||
|
|
||||||
def limbs_mpi(val: int, bits_in_limb: int) -> int:
|
def limbs_mpi(val: int, bits_in_limb: int) -> int:
|
||||||
"""Return the number of limbs required to store value."""
|
"""Return the number of limbs required to store value."""
|
||||||
return (val.bit_length() + bits_in_limb - 1) // bits_in_limb
|
bit_length = max(val.bit_length(), 1)
|
||||||
|
return (bit_length + bits_in_limb - 1) // bits_in_limb
|
||||||
|
|
||||||
def combination_pairs(values: List[T]) -> List[Tuple[T, T]]:
|
def combination_pairs(values: List[T]) -> List[Tuple[T, T]]:
|
||||||
"""Return all pair combinations from input values."""
|
"""Return all pair combinations from input values."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user