Browse Source

Fixed some corner cases

pull/587/head
LordJZ 10 years ago
parent
commit
7cacb70148
  1. 1
      ICSharpCode.Decompiler/ILAst/ILAstOptimizer.cs
  2. 5
      ICSharpCode.Decompiler/Tests/UnsafeCode.cs

1
ICSharpCode.Decompiler/ILAst/ILAstOptimizer.cs

@ -839,6 +839,7 @@ namespace ICSharpCode.Decompiler.ILAst @@ -839,6 +839,7 @@ namespace ICSharpCode.Decompiler.ILAst
}
}
if (!(sizeOfExpression.Code == ILCode.Ldc_I4 && (int)sizeOfExpression.Operand == 1))
adjustmentExpr = new ILExpression(divide ? ILCode.Div_Un : ILCode.Mul, null, adjustmentExpr, sizeOfExpression);
}

5
ICSharpCode.Decompiler/Tests/UnsafeCode.cs

@ -143,6 +143,11 @@ public class UnsafeCode @@ -143,6 +143,11 @@ public class UnsafeCode
return (long*)((byte*)p + 3);
}
public unsafe int PointerArithmetic5(void* p, byte* q, int i)
{
return (int)(q[i] + *(byte*)p);
}
public unsafe int PointerSubtraction(long* p, long* q)
{
return (int)((long)(p - q));

Loading…
Cancel
Save