From: whitequark Date: Tue, 19 May 2020 23:43:25 +0000 (+0000) Subject: hdl.ast: clarify docs for Value.rotate_{left,right}. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4a326d5fed14abb3ecbb36ac8e9fb18becd8203a;p=nmigen.git hdl.ast: clarify docs for Value.rotate_{left,right}. "Rotate modulo 2**len(self)" is redundant because that's just how rotates work. --- diff --git a/nmigen/hdl/ast.py b/nmigen/hdl/ast.py index e5ade85..a7f77e2 100644 --- a/nmigen/hdl/ast.py +++ b/nmigen/hdl/ast.py @@ -424,7 +424,7 @@ class Value(metaclass=ABCMeta): return Cat(*matches).any() def rotate_left(self, offset): - """Rotate left by constant modulo 2**len(self). + """Rotate left by constant amount. Parameters ---------- @@ -434,7 +434,7 @@ class Value(metaclass=ABCMeta): Returns ------- Value, out - The input rotated left by offset if offset is positive, else the input rotated right by -offset. + If the offset is positive, the input rotated left. Otherwise, the input rotated right. """ if not isinstance(offset, int): raise TypeError("Rotate amount must be an integer, not {!r}".format(offset)) @@ -442,7 +442,7 @@ class Value(metaclass=ABCMeta): return Cat(self[-offset:], self[:-offset]) # meow :3 def rotate_right(self, offset): - """Rotate right by constant modulo 2**len(self). + """Rotate right by constant amount. Parameters ---------- @@ -452,7 +452,7 @@ class Value(metaclass=ABCMeta): Returns ------- Value, out - The input rotated right by offset if offset is positive, else the input rotated left by -offset. + If the offset is positive, the input rotated right. Otherwise, the input rotated right. """ if not isinstance(offset, int): raise TypeError("Rotate amount must be an integer, not {!r}".format(offset))