From 7f8a35ae6f514a55bcdee2f6bd6871c129fc6379 Mon Sep 17 00:00:00 2001 From: Cesar Strauss Date: Sat, 23 Jan 2021 17:31:39 -0300 Subject: [PATCH] Implement PartitionedSignal.like() --- src/ieee754/part/partsig.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ieee754/part/partsig.py b/src/ieee754/part/partsig.py index ab14bf99..fb06a1b9 100644 --- a/src/ieee754/part/partsig.py +++ b/src/ieee754/part/partsig.py @@ -60,6 +60,14 @@ class PartitionedSignal: def eq(self, val): return self.sig.eq(getsig(val)) + @staticmethod + def like(other, *args, **kwargs): + """Builds a new PartitionedSignal with the same PartitionPoints and + Signal properties as the other""" + result = PartitionedSignal(other.partpoints) + result.sig = Signal.like(other.sig, *args, **kwargs) + return result + # unary ops that do not require partitioning def __invert__(self): -- 2.30.2