예제 #1
0
        // taken from System.Reflection.Emit.OpCode

        internal MsilOpCode(MsilCode value, int flags)
            : this()
        {
            Name = value.ToString().ToLowerInvariant().Replace('_', '.');
            StackBehaviourPop  = (MsilStackBehaviour)(flags >> 12 & 31);
            StackBehaviourPush = (MsilStackBehaviour)(flags >> 17 & 31);
            OperandType        = (MsilOperandType)(flags & 31);
            OpCodeType         = (MsilOpCodeType)(flags >> 9 & 7);
            Size        = (flags >> 22 & 3);
            Op1         = (byte)((ushort)value >> 8);
            Op2         = (byte)value;
            Code        = value;
            FlowControl = (MsilFlowControl)(flags >> 5 & 15);
            // m_endsUncondJmpBlk = ((flags & 16777216) != 0);
            // m_stackChange = flags >> 28;

            if (Size == 1)
            {
                MsilOpCodes.SingleByteOpCodes[Op2] = this;
            }
            else
            {
                MsilOpCodes.MultiByteOpCodes[Op2] = this;
            }
        }
예제 #2
0
        public static MsilOpCode GetOpCode(MsilCode code)
        {
            var value = (int)code;

            if ((value & 0xFE00) == 0xFE00)
            {
                return(MultiByteOpCodes[value & 0xFF]);
            }
            return(SingleByteOpCodes[value & 0xFF]);
        }
예제 #3
0
 public static MsilOpCode GetOpCode(MsilCode code)
 {
     var value = (int)code;
     if ((value & 0xFE00) == 0xFE00)
         return MultiByteOpCodes[value & 0xFF];
     return SingleByteOpCodes[value & 0xFF];
 }