add shift operators TODO on partsig
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 7 Feb 2020 16:29:19 +0000 (16:29 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 7 Feb 2020 16:29:19 +0000 (16:29 +0000)
src/ieee754/part/partsig.py

index 1eae4a140a44b823e4ceda3adcb590eecc4c5d4a..cef3fed6b2654b25d133d188a25d97480605c40f 100644 (file)
@@ -86,6 +86,15 @@ class PartitionedSignal:
 
     # binary ops that need partitioning
 
+    def __lshift__(self, other):
+        return Operator("<<", [self, other])
+    def __rlshift__(self, other):
+        return Operator("<<", [other, self])
+    def __rshift__(self, other):
+        return Operator(">>", [self, other])
+    def __rrshift__(self, other):
+        return Operator(">>", [other, self])
+
     def __add__(self, other):
         shape = self.sig.shape()
         pa = PartitionedAdder(shape[0], self.partpoints)