Use a common function to calculate the number of hex digits
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
This commit is contained in:
parent
aef0f2de9f
commit
7c8d706f4e
1 changed files with 5 additions and 1 deletions
|
@ -74,6 +74,10 @@ def combination_pairs(values: List[T]) -> List[Tuple[T, T]]:
|
|||
"""Return all pair combinations from input values."""
|
||||
return [(x, y) for x in values for y in values]
|
||||
|
||||
def hex_digits_for_limb(limbs: int, bits_in_limb: int) -> int:
|
||||
""" Retrun the hex digits need for a number of limbs. """
|
||||
return 2 * (limbs * bits_in_limb // 8)
|
||||
|
||||
class OperationCommon(test_data_generation.BaseTest):
|
||||
"""Common features for bignum binary operations.
|
||||
|
||||
|
@ -138,7 +142,7 @@ class OperationCommon(test_data_generation.BaseTest):
|
|||
|
||||
@property
|
||||
def hex_digits(self) -> int:
|
||||
return 2 * (self.limbs * self.bits_in_limb // 8)
|
||||
return hex_digits_for_limb(self.limbs, self.bits_in_limb)
|
||||
|
||||
def format_arg(self, val: str) -> str:
|
||||
if self.input_style not in self.input_styles:
|
||||
|
|
Loading…
Reference in a new issue