AsmResolver.Net.Msil.MethodBody.TryOptimizeLdc C# (CSharp) Метод

TryOptimizeLdc() приватный Метод

private TryOptimizeLdc ( MsilInstruction instruction ) : void
instruction MsilInstruction
Результат void
        private void TryOptimizeLdc(MsilInstruction instruction)
        {
            int value = (int) instruction.Operand;
            if (value >= -1 && value <= 8)
            {
                instruction.OpCode = MsilOpCodes.SingleByteOpCodes[MsilOpCodes.Ldc_I4_0.Op2 + value];
                instruction.Operand = null;
            }
            else if (value >= sbyte.MinValue && value <= sbyte.MaxValue)
            {
                instruction.OpCode = MsilOpCodes.Ldc_I4_S;
                instruction.Operand = Convert.ToSByte(value);
            }
        }