|
|
|
@ -1,4 +1,4 @@
@@ -1,4 +1,4 @@
|
|
|
|
|
// Copyright (c) 2015 Siegfried Pammer
|
|
|
|
|
// Copyright (c) 2015 Siegfried Pammer
|
|
|
|
|
//
|
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
|
|
|
|
// software and associated documentation files (the "Software"), to deal in the Software
|
|
|
|
@ -871,10 +871,18 @@ namespace ICSharpCode.Decompiler.IL.Transforms
@@ -871,10 +871,18 @@ namespace ICSharpCode.Decompiler.IL.Transforms
|
|
|
|
|
} |
|
|
|
|
if (UnwrapSmallIntegerConv(value, out var conv) is BinaryNumericInstruction binary) |
|
|
|
|
{ |
|
|
|
|
if (!binary.Left.MatchLdLoc(tmpVar) || !(binary.Right.MatchLdcI(1) || binary.Right.MatchLdcF4(1) || binary.Right.MatchLdcF8(1))) |
|
|
|
|
return false; |
|
|
|
|
if (!(binary.Operator == BinaryNumericOperator.Add || binary.Operator == BinaryNumericOperator.Sub)) |
|
|
|
|
return false; |
|
|
|
|
if (!binary.Left.MatchLdLoc(tmpVar)) |
|
|
|
|
return false; |
|
|
|
|
if (targetType is PointerType ptrType) |
|
|
|
|
{ |
|
|
|
|
var right = PointerArithmeticOffset.Detect(binary.Right, ptrType.ElementType, binary.CheckForOverflow); |
|
|
|
|
if (right is null || !right.MatchLdcI(1)) |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
else if (!(binary.Right.MatchLdcI(1) || binary.Right.MatchLdcF4(1) || binary.Right.MatchLdcF8(1))) |
|
|
|
|
return false; |
|
|
|
|
if (!ValidateCompoundAssign(binary, conv, targetType, context.Settings)) |
|
|
|
|
return false; |
|
|
|
|
context.Step("TransformPostIncDecOperator (builtin)", inst); |
|
|
|
|