power_fields: fix mapping class accessor
authorDmitry Selyutin <ghostmansd@gmail.com>
Sat, 17 Sep 2022 20:26:42 +0000 (23:26 +0300)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 17 Sep 2022 20:28:53 +0000 (21:28 +0100)
src/openpower/decoder/power_fields.py
src/openpower/decoder/power_insn.py

index f69f78552651153beae12aa6e11e94e61f33775c..0f809a55142acf055f7c0ad8a4a32e4f4478444b 100644 (file)
@@ -232,17 +232,7 @@ class MappingMeta(type):
         return length
 
     def __getitem__(cls, selector):
-        best_min = 0
-        best_max = 0
-        for field in cls.__members__.values():
-            length = len(field)
-            best_min = min(best_min, length)
-            best_max = max(best_max, length)
-
-        items = tuple(range(best_min, best_max))
-        field = FieldMeta(cls.__name__, (Field,), {}, items=items)
-
-        return field[selector]
+        return cls.__members__["_"][selector]
 
     def remap(cls, scheme):
         ns = {}
index 7d126bb8f74b21b3d2cccf5b5cc7a37280962f83..2062d07a5f894ed085d47eedd005689d093fbcf0 100644 (file)
@@ -1302,6 +1302,7 @@ class BaseRM(_Mapping):
 class NormalBaseRM(BaseRM):
     pass
 
+
 class NormalSimpleRM(NormalBaseRM):
     """normal: simple mode"""
     dz: BaseRM.mode[3]