001    /* MBEL: The Microsoft Bytecode Engineering Library
002     * Copyright (C) 2003 The University of Arizona
003     * http://www.cs.arizona.edu/mbel/license.html
004     *
005     * This library is free software; you can redistribute it and/or
006     * modify it under the terms of the GNU Lesser General Public
007     * License as published by the Free Software Foundation; either
008     * version 2.1 of the License, or (at your option) any later version.
009     * 
010     * This library is distributed in the hope that it will be useful,
011     * but WITHOUT ANY WARRANTY; without even the implied warranty of
012     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013     * Lesser General Public License for more details.
014     * 
015     * You should have received a copy of the GNU Lesser General Public
016     * License along with this library; if not, write to the Free Software
017     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
018     */
019    
020    package edu.arizona.cs.mbel.instructions;
021    
022    /** Convert values with overflow detection (unsigned).<br>
023      * Stack transition:<br>
024      *   ..., value --> ..., result
025      * @author Michael Stepp
026      */
027    public class CONV_OVF_UN extends Instruction{
028       public static final int CONV_OVF_I1_UN = 0x82;
029       public static final int CONV_OVF_I2_UN = 0x83;
030       public static final int CONV_OVF_I4_UN = 0x84;
031       public static final int CONV_OVF_I8_UN = 0x85;
032       public static final int CONV_OVF_U1_UN = 0x86;
033       public static final int CONV_OVF_U2_UN = 0x87;
034       public static final int CONV_OVF_U4_UN = 0x88;
035       public static final int CONV_OVF_U8_UN = 0x89;
036       public static final int CONV_OVF_I_UN  = 0x8A;
037       public static final int CONV_OVF_U_UN  = 0x8B;
038       protected static final int OPCODE_LIST[] = { CONV_OVF_I1_UN, CONV_OVF_I2_UN, CONV_OVF_I4_UN, CONV_OVF_I8_UN, CONV_OVF_U1_UN, 
039                                                 CONV_OVF_U2_UN, CONV_OVF_U4_UN, CONV_OVF_U8_UN, CONV_OVF_I_UN,  CONV_OVF_U_UN };
040    
041       /** Makes a CONV_OVF_UN object corresponding to the given opcode
042         * @param op the opcode (must be one of CONV_OVF_I1_UN, CONV_OVF_I2_UN, etc)
043         */
044       public CONV_OVF_UN(int op) throws InstructionInitException{
045          super(op, OPCODE_LIST);
046       }
047    
048       public String getName(){
049          String str[] = {  "conv.ovf.i1.un", "conv.ovf.i2.un", "conv.ovf.i4.un", "conv.ovf.i8.un", "conv.ovf.u1.un",
050                            "conv.ovf.u2.un", "conv.ovf.u4.un", "conv.ovf.u8.un", "conv.ovf.i.un", "conv.ovf.u.un"};
051          for (int i=0;i<str.length;i++)
052             if (getOpcode()==OPCODE_LIST[i])
053                return str[i];
054          return "";
055       }
056    
057       public CONV_OVF_UN(int opcode, edu.arizona.cs.mbel.mbel.ClassParser parse) throws java.io.IOException, InstructionInitException{
058          super(opcode, OPCODE_LIST);
059       }
060       
061       public boolean equals(Object o){
062          return (super.equals(o) && (o instanceof CONV_OVF_UN));
063       }
064    }