diff --git a/bitutilities.py b/bitutilities.py index fdcfeb6..c62c538 100644 --- a/bitutilities.py +++ b/bitutilities.py @@ -115,9 +115,14 @@ def align_registers(first_register: BasicRegister, second_register: BasicRegiste first_size = len(first_register) second_size = len(second_register) - required_size = max(first_size, second_size) +def align_registers(*args: BasicRegister) -> tuple[BasicRegister, ...]: + """ + Aligns registers by the length of the bigger one. - if first_size != second_size: - return first_register.adjusted_by_size(required_size), second_register.adjusted_by_size(required_size) - else: - return first_register, second_register + :param args: Basic registers to align. + + :return: Aligned registers. + :rtype: tuple[BasicRegister, ...] + """ + required_size: int = max(map(len, args)) + return tuple(reg.adjusted_by_size(required_size) for reg in args)