當前位置: 首頁>>代碼示例>>Java>>正文


Java Type.SHORT_TYPE屬性代碼示例

本文整理匯總了Java中org.objectweb.asm.Type.SHORT_TYPE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Type.SHORT_TYPE屬性的具體用法?Java Type.SHORT_TYPE怎麽用?Java Type.SHORT_TYPE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.objectweb.asm.Type的用法示例。


在下文中一共展示了Type.SHORT_TYPE屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getArrayElementTypeForOpcode

private static Type getArrayElementTypeForOpcode(int opcode) {
  switch (opcode) {
    case Opcodes.IALOAD:
    case Opcodes.IASTORE:
      return Type.INT_TYPE;
    case Opcodes.FALOAD:
    case Opcodes.FASTORE:
      return Type.FLOAT_TYPE;
    case Opcodes.LALOAD:
    case Opcodes.LASTORE:
      return Type.LONG_TYPE;
    case Opcodes.DALOAD:
    case Opcodes.DASTORE:
      return Type.DOUBLE_TYPE;
    case Opcodes.AALOAD:
    case Opcodes.AASTORE:
      return JarState.NULL_TYPE; // We might not know the type.
    case Opcodes.BALOAD:
    case Opcodes.BASTORE:
      return Type.BYTE_TYPE; // We don't distinguish byte and boolean.
    case Opcodes.CALOAD:
    case Opcodes.CASTORE:
      return Type.CHAR_TYPE;
    case Opcodes.SALOAD:
    case Opcodes.SASTORE:
      return Type.SHORT_TYPE;
    default:
      throw new Unreachable("Unexpected array opcode " + opcode);
  }
}
 
開發者ID:inferjay,項目名稱:r8,代碼行數:30,代碼來源:JarSourceCode.java

示例2: cast

public void cast(final Type from, final Type to) {
    if (from != to) {
        if (from == Type.DOUBLE_TYPE) {
            if (to == Type.FLOAT_TYPE) {
                mv.visitInsn(Opcodes.D2F);
            } else if (to == Type.LONG_TYPE) {
                mv.visitInsn(Opcodes.D2L);
            } else {
                mv.visitInsn(Opcodes.D2I);
                cast(Type.INT_TYPE, to);
            }
        } else if (from == Type.FLOAT_TYPE) {
            if (to == Type.DOUBLE_TYPE) {
                mv.visitInsn(Opcodes.F2D);
            } else if (to == Type.LONG_TYPE) {
                mv.visitInsn(Opcodes.F2L);
            } else {
                mv.visitInsn(Opcodes.F2I);
                cast(Type.INT_TYPE, to);
            }
        } else if (from == Type.LONG_TYPE) {
            if (to == Type.DOUBLE_TYPE) {
                mv.visitInsn(Opcodes.L2D);
            } else if (to == Type.FLOAT_TYPE) {
                mv.visitInsn(Opcodes.L2F);
            } else {
                mv.visitInsn(Opcodes.L2I);
                cast(Type.INT_TYPE, to);
            }
        } else {
            if (to == Type.BYTE_TYPE) {
                mv.visitInsn(Opcodes.I2B);
            } else if (to == Type.CHAR_TYPE) {
                mv.visitInsn(Opcodes.I2C);
            } else if (to == Type.DOUBLE_TYPE) {
                mv.visitInsn(Opcodes.I2D);
            } else if (to == Type.FLOAT_TYPE) {
                mv.visitInsn(Opcodes.I2F);
            } else if (to == Type.LONG_TYPE) {
                mv.visitInsn(Opcodes.I2L);
            } else if (to == Type.SHORT_TYPE) {
                mv.visitInsn(Opcodes.I2S);
            }
        }
    }
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:46,代碼來源:InstructionAdapter.java

示例3: cast

/**
 * Generates the instructions to cast a numerical value from one type to
 * another.
 * 
 * @param from
 *            the type of the top stack value
 * @param to
 *            the type into which this value must be cast.
 */
public void cast(final Type from, final Type to) {
    if (from != to) {
        if (from == Type.DOUBLE_TYPE) {
            if (to == Type.FLOAT_TYPE) {
                mv.visitInsn(Opcodes.D2F);
            } else if (to == Type.LONG_TYPE) {
                mv.visitInsn(Opcodes.D2L);
            } else {
                mv.visitInsn(Opcodes.D2I);
                cast(Type.INT_TYPE, to);
            }
        } else if (from == Type.FLOAT_TYPE) {
            if (to == Type.DOUBLE_TYPE) {
                mv.visitInsn(Opcodes.F2D);
            } else if (to == Type.LONG_TYPE) {
                mv.visitInsn(Opcodes.F2L);
            } else {
                mv.visitInsn(Opcodes.F2I);
                cast(Type.INT_TYPE, to);
            }
        } else if (from == Type.LONG_TYPE) {
            if (to == Type.DOUBLE_TYPE) {
                mv.visitInsn(Opcodes.L2D);
            } else if (to == Type.FLOAT_TYPE) {
                mv.visitInsn(Opcodes.L2F);
            } else {
                mv.visitInsn(Opcodes.L2I);
                cast(Type.INT_TYPE, to);
            }
        } else {
            if (to == Type.BYTE_TYPE) {
                mv.visitInsn(Opcodes.I2B);
            } else if (to == Type.CHAR_TYPE) {
                mv.visitInsn(Opcodes.I2C);
            } else if (to == Type.DOUBLE_TYPE) {
                mv.visitInsn(Opcodes.I2D);
            } else if (to == Type.FLOAT_TYPE) {
                mv.visitInsn(Opcodes.I2F);
            } else if (to == Type.LONG_TYPE) {
                mv.visitInsn(Opcodes.I2L);
            } else if (to == Type.SHORT_TYPE) {
                mv.visitInsn(Opcodes.I2S);
            }
        }
    }
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:55,代碼來源:GeneratorAdapter.java


注:本文中的org.objectweb.asm.Type.SHORT_TYPE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。