diff --git a/bitutilities.py b/bitutilities.py index e9aa54d..064ed3b 100644 --- a/bitutilities.py +++ b/bitutilities.py @@ -4,7 +4,7 @@ from collections import deque class BasicRegister: """The BasicRegister represents a hardware register capable of manipulating multiple bits at a time. - :param list[bool] memory: The bits stored inside the register. + :param deque[bool] memory: The bits stored inside the register. """ def __init__(self, memory: list[bool]): @@ -15,7 +15,8 @@ class BasicRegister: return f"Memory: {[int(value) for value in self.memory]}" def reverse(self): - self.memory = [not value for value in self.memory] + for i, value in enumerate(self.memory): + self.memory[i] = not value def left_shift(self, digit_to_fill: bool = False, steps_shifted: int = 1) -> deque[bool]: self.memory.extend([digit_to_fill] * steps_shifted)