You've already forked linux-packaging-mono
Imported Upstream version 4.8.0.459
Former-commit-id: 2a5b9df2014f72665850c7f885e7aed54704a53a
This commit is contained in:
parent
a355c1b831
commit
e5cd25ff4f
@@ -174,6 +174,29 @@ namespace Mono.Cecil.Rocks {
|
||||
instruction.Operand = null;
|
||||
}
|
||||
|
||||
public static void Optimize (this MethodBody self)
|
||||
{
|
||||
if (self == null)
|
||||
throw new ArgumentNullException ("self");
|
||||
|
||||
OptimizeLongs (self);
|
||||
OptimizeMacros (self);
|
||||
}
|
||||
|
||||
static void OptimizeLongs (this MethodBody self)
|
||||
{
|
||||
for (var i = 0; i < self.Instructions.Count; i++) {
|
||||
var instruction = self.Instructions [i];
|
||||
if (instruction.OpCode.Code != Code.Ldc_I8)
|
||||
continue;
|
||||
var l = (long)instruction.Operand;
|
||||
if (l >= uint.MaxValue)
|
||||
continue;
|
||||
ExpandMacro (instruction, OpCodes.Ldc_I4, (uint)l);
|
||||
self.Instructions.Insert (++i, Instruction.Create (OpCodes.Conv_I8));
|
||||
}
|
||||
}
|
||||
|
||||
public static void OptimizeMacros (this MethodBody self)
|
||||
{
|
||||
if (self == null)
|
||||
|
Reference in New Issue
Block a user