// 00: ldarg.0    n
 // 01: ldarg.1    m
 // 02: mul.ovf
 // 03: conv.i8
 public void VisitConvert(Conv convert)
 {
     if (m_offset < 0)
     {
         switch (convert.Untyped.OpCode.Code)
         {
         case Code.Conv_I8:
         case Code.Conv_Ovf_I8_Un:
         case Code.Conv_Ovf_I8:
         case Code.Conv_U8:
         case Code.Conv_Ovf_U8_Un:
         case Code.Conv_Ovf_U8:
             OpCode prev = m_info.Instructions[convert.Index - 1].Untyped.OpCode;
             if (prev.Code == Code.Mul || prev.Code == Code.Mul_Ovf || prev.Code == Code.Mul_Ovf_Un)
             {
                 if (IntegerHelpers.IsIntOperand(m_info, convert.Index - 1, 0) || IntegerHelpers.IsIntOperand(m_info, convert.Index - 1, 1))
                 {
                     m_offset = convert.Untyped.Offset;
                     Log.DebugLine(this, "bad convert at {0:X2}", m_offset);
                 }
             }
             break;
         }
     }
 }
 public void VisitConvert(Conv convert)
 {
     if (m_offset < 0 && convert.Index >= 3)
     {
         switch (convert.Untyped.OpCode.Code)
         {
         case Code.Conv_R4:
         case Code.Conv_R8:
         case Code.Conv_R_Un:
             OpCode prev = m_info.Instructions[convert.Index - 1].Untyped.OpCode;
             if (prev.Code == Code.Div || prev.Code == Code.Div_Un)
             {
                 if (IntegerHelpers.IsIntOperand(m_info, convert.Index - 1, 0) && IntegerHelpers.IsIntOperand(m_info, convert.Index - 1, 1))
                 {
                     m_offset = convert.Untyped.Offset;
                     Log.DebugLine(this, "bad convert at {0:X2}", m_offset);
                 }
             }
             break;
         }
     }
 }
Exemple #3
0
        // 00: ldarg.0    a
        // 01: ldarg.1    b
        // 02: add.ovf
        // 03: ldc.i4.2
        // 04: div
        public void VisitBinary(BinaryOp binary)
        {
            do
            {
                if (m_offset >= 0)
                {
                    break;
                }

                int i = binary.Index;
                if (i < 4)
                {
                    break;
                }

                if (!DoMatch(i, Code.Div, Code.Div_Un) || !DoMatch(i - 1, Code.Ldc_I4_2))
                {
                    if (!DoMatch(i, Code.Shr, Code.Shr_Un) || !DoMatch(i - 1, Code.Ldc_I4_1))
                    {
                        break;
                    }
                }

                if (!DoMatch(i - 2, Code.Add, Code.Add_Ovf))
                {
                    break;
                }

                if (!IntegerHelpers.IsIntOperand(m_info, i - 2, 0) || !IntegerHelpers.IsIntOperand(m_info, i - 2, 1))
                {
                    break;
                }

                m_offset = binary.Untyped.Offset;
            }while (false);
        }