Shift methods updated.
This commit is contained in:
parent
5fece34356
commit
9f12616eca
|
@ -11,14 +11,14 @@ class BasicRegister:
|
|||
def reverse(self):
|
||||
self.memory = [not value for value in self.memory]
|
||||
|
||||
def left_shift(self, steps_shifted: int) -> list[bool]:
|
||||
self.memory.extend([False] * steps_shifted)
|
||||
def left_shift(self, digit_to_fill: bool = False, steps_shifted: int = 1) -> list[bool]:
|
||||
self.memory.extend([digit_to_fill] * steps_shifted)
|
||||
shifted_radices: list[bool] = self.memory[:steps_shifted]
|
||||
del self.memory[:steps_shifted]
|
||||
return shifted_radices
|
||||
|
||||
def right_shift(self, steps_shifted: int) -> list[bool]:
|
||||
self.memory[:0] = [False] * steps_shifted
|
||||
def right_shift(self, digit_to_fill: bool = False, steps_shifted: int = 1) -> list[bool]:
|
||||
self.memory[:0] = [digit_to_fill] * steps_shifted
|
||||
shifted_radices: list[bool] = self.memory[-steps_shifted:]
|
||||
del self.memory[-steps_shifted:]
|
||||
return shifted_radices
|
||||
|
|
Loading…
Reference in New Issue