|
|
@ -327,11 +327,16 @@ namespace ICSharpCode.Decompiler.IL |
|
|
|
/// </summary>
|
|
|
|
public bool MatchCompEquals(out ILInstruction left, out ILInstruction right) |
|
|
|
{ |
|
|
|
if (this.MatchLogicNot(out var arg) && arg is Comp nestedComp && nestedComp.Kind == ComparisonKind.Inequality && !nestedComp.IsLifted) { |
|
|
|
left = nestedComp.Left; |
|
|
|
right = nestedComp.Right; |
|
|
|
return true; |
|
|
|
} else if (this is Comp comp && comp.Kind == ComparisonKind.Equality && !comp.IsLifted) { |
|
|
|
ILInstruction thisInst = this; |
|
|
|
var compKind = ComparisonKind.Equality; |
|
|
|
while (thisInst.MatchLogicNot(out var arg) && arg is Comp) { |
|
|
|
thisInst = arg; |
|
|
|
if (compKind == ComparisonKind.Equality) |
|
|
|
compKind = ComparisonKind.Inequality; |
|
|
|
else |
|
|
|
compKind = ComparisonKind.Equality; |
|
|
|
} |
|
|
|
if (thisInst is Comp comp && comp.Kind == compKind && !comp.IsLifted) { |
|
|
|
left = comp.Left; |
|
|
|
right = comp.Right; |
|
|
|
return true; |
|
|
@ -389,11 +394,16 @@ namespace ICSharpCode.Decompiler.IL |
|
|
|
/// </summary>
|
|
|
|
public bool MatchCompNotEquals(out ILInstruction left, out ILInstruction right) |
|
|
|
{ |
|
|
|
if (this.MatchLogicNot(out var arg) && arg is Comp nestedComp && nestedComp.Kind == ComparisonKind.Equality && !nestedComp.IsLifted) { |
|
|
|
left = nestedComp.Left; |
|
|
|
right = nestedComp.Right; |
|
|
|
return true; |
|
|
|
} else if (this is Comp comp && comp.Kind == ComparisonKind.Inequality && !comp.IsLifted) { |
|
|
|
ILInstruction thisInst = this; |
|
|
|
var compKind = ComparisonKind.Inequality; |
|
|
|
while (thisInst.MatchLogicNot(out var arg) && arg is Comp) { |
|
|
|
thisInst = arg; |
|
|
|
if (compKind == ComparisonKind.Equality) |
|
|
|
compKind = ComparisonKind.Inequality; |
|
|
|
else |
|
|
|
compKind = ComparisonKind.Equality; |
|
|
|
} |
|
|
|
if (thisInst is Comp comp && comp.Kind == compKind && !comp.IsLifted) { |
|
|
|
left = comp.Left; |
|
|
|
right = comp.Right; |
|
|
|
return true; |
|
|
|