/* Copyright (C) 2004 - 2006 db4objects Inc. http://www.db4o.com This file is part of the db4o open source object database. db4o is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation and as clarified by db4objects' GPL interpretation policy, available at http://www.db4o.com/about/company/legalpolicies/gplinterpretation/ Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street, Suite 350, San Mateo, CA 94403, USA. db4o is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ namespace Mono.Cecil.Cil { public struct OpCode { string m_name; byte m_op1; byte m_op2; int m_size; FlowControl m_flowControl; OpCodeType m_opCodeType; OperandType m_operandType; StackBehaviour m_stackBehaviourPop; StackBehaviour m_stackBehaviourPush; public string Name { get { return m_name; } } public int Size { get { return m_size; } } public byte Op1 { get { return m_op1; } } public byte Op2 { get { return m_op2; } } public short Value { get { return m_size == 1 ? m_op2 : (short) ((m_op1 << 8) | m_op2); } } public FlowControl FlowControl { get { return m_flowControl; } } public OpCodeType OpCodeType { get { return m_opCodeType; } } public OperandType OperandType { get { return m_operandType; } } public StackBehaviour StackBehaviourPop { get { return m_stackBehaviourPop; } } public StackBehaviour StackBehaviourPush { get { return m_stackBehaviourPush; } } internal OpCode (string name, byte op1, byte op2, int size, FlowControl flowControl, OpCodeType opCodeType, OperandType operandType, StackBehaviour pop, StackBehaviour push) { m_name = name; m_op1 = op1; m_op2 = op2; m_size = size; m_flowControl = flowControl; m_opCodeType = opCodeType; m_operandType = operandType; m_stackBehaviourPop = pop; m_stackBehaviourPush = push; } public override int GetHashCode () { return this.Value; } public override bool Equals (object obj) { if (!(obj is OpCode)) return false; OpCode v = (OpCode) obj; return v.m_op1 == m_op1 && v.m_op2 == m_op2; } public static bool operator == (OpCode one, OpCode other) { return one.Equals (other); } public static bool operator != (OpCode one, OpCode other) { return !one.Equals (other); } public override string ToString () { return m_name; } } }