Skip to contentSkip to conversation

decodetree: Fix comparison of Field

PATCH In review Richard Henderson 3 participants 3 messages Jun 4, 2019 – Jun 11, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 decodetree: Fix comparison of Field

Typo comparing the sign of the field, twice, instead of also comparing the mask of the field (which itself encodes both position and length).

---
 scripts/decodetree.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/decodetree.py +1 -1
index 81874e22cc..d7a59d63ac 100755
@@ -184,7 +184,7 @@ class Field:
         return '{0}(insn, {1}, {2})'.format(extr, self.pos, self.len)
 
     def __eq__(self, other):
-        return self.sign == other.sign and self.sign == other.sign
+        return self.sign == other.sign and self.mask == other.mask
 
     def __ne__(self, other):
         return not self.__eq__(other)
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Richard Henderson

Typo comparing the sign of the field, twice, instead of also comparing the mask of the field (which itself encodes both position and length).

---
 scripts/decodetree.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/decodetree.py +0 -0
index 81874e22cc..d7a59d63ac 100755

scripts/decodetree.py class Field:

Quoted 9 lines
scripts/decodetree.py +1 -2
@@ -184,7 +184,7 @@ class Field:
         return '{0}(insn, {1}, {2})'.format(extr, self.pos, self.len)
 
     def __eq__(self, other):
-        return self.sign == other.sign and self.sign == other.sign
+        return self.sign == other.sign and self.mask == other.mask
 
     def __ne__(self, other):
         return not self.__eq__(other)
--

This fixes the problems I was seeing with the VFP decodetree conversion I was working on.

thanks
-- PMM

Reviewed-by on v1 1/1
#2 lore raw
In reply to Richard Henderson
Quoted 14 lines · Richard Henderson

Typo comparing the sign of the field, twice, instead of also comparing the mask of the field (which itself encodes both position and length).

---
 scripts/decodetree.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/decodetree.py +0 -0
index 81874e22cc..d7a59d63ac 100755

scripts/decodetree.py class Field: · line 187

Quoted 5 lines
scripts/decodetree.py +1 -1
@@ -184,7 +184,7 @@ class Field:
         return '{0}(insn, {1}, {2})'.format(extr, self.pos, self.len)
 
     def __eq__(self, other):
-        return self.sign == other.sign and self.sign == other.sign
+        return self.sign == other.sign and self.mask == other.mask

Argh

Quoted 4 lines
scripts/decodetree.py +0 -0
     def __ne__(self, other):
         return not self.__eq__(other)