From 9f12616eca6a90c36095ccc871647d571dec18b3 Mon Sep 17 00:00:00 2001 From: Rhinemann Date: Sun, 18 Jun 2023 14:51:13 +0300 Subject: [PATCH] Shift methods updated. --- BasicRegister.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/BasicRegister.py b/BasicRegister.py index 0e55563..044c51a 100644 --- a/BasicRegister.py +++ b/BasicRegister.py @@ -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