示例#1
0
        private InstructionStub RecognizeInstruction()
        {
            InstructionStub instrStub = null;

            byte[] opcode;
            int    opcodeLength = 1;

            do
            {
                opcode    = ModuleReader.PeekBytes(opcodeLength);
                instrStub = OpcodeTable.GetValueOrDefault(opcode.ToImmutableArray());
                if (instrStub == null)
                {
                    opcodeLength++;
                }
            } while (instrStub == null && opcodeLength <= 3);

            if (instrStub == null)
            {
                throw new UnrecognizedInstructionException();
            }

            Position += opcodeLength;
            return(instrStub);
        }