From: Dmitry Selyutin Date: Fri, 6 Jan 2023 17:22:53 +0000 (+0300) Subject: power_fields: support assignment to same class instance X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9e8e5eddcc55d9ded72cd2b69f0b61963787b1b8;p=openpower-isa.git power_fields: support assignment to same class instance --- diff --git a/src/openpower/decoder/power_fields.py b/src/openpower/decoder/power_fields.py index 856182f3..b0f17909 100644 --- a/src/openpower/decoder/power_fields.py +++ b/src/openpower/decoder/power_fields.py @@ -102,7 +102,8 @@ class Reference: bits = range(bits.start, bits.stop) bits = tuple(bits) - if isinstance(value, int): + if isinstance(value, (int, self.__class__)): + value = int(value) if value.bit_length() > len(bits): raise OverflowError(value) value = _SelectableInt(value=value, bits=len(bits))