当前位置: 首页>>代码示例>>Java>>正文


Java WideLiteralInstruction类代码示例

本文整理汇总了Java中org.jf.dexlib2.iface.instruction.WideLiteralInstruction的典型用法代码示例。如果您正苦于以下问题:Java WideLiteralInstruction类的具体用法?Java WideLiteralInstruction怎么用?Java WideLiteralInstruction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WideLiteralInstruction类属于org.jf.dexlib2.iface.instruction包,在下文中一共展示了WideLiteralInstruction类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeLiteral

import org.jf.dexlib2.iface.instruction.WideLiteralInstruction; //导入依赖的package包/类
protected void writeLiteral(IndentingWriter writer) throws IOException {
    LongRenderer.writeSignedIntOrLongTo(writer, ((WideLiteralInstruction) instruction).getWideLiteral());
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:4,代码来源:InstructionMethodItem.java

示例2: writeCommentIfLikelyDouble

import org.jf.dexlib2.iface.instruction.WideLiteralInstruction; //导入依赖的package包/类
protected void writeCommentIfLikelyDouble(IndentingWriter writer) throws IOException {
    writeCommentIfLikelyDouble(writer, ((WideLiteralInstruction) instruction).getWideLiteral());
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:4,代码来源:InstructionMethodItem.java

示例3: getConstant

import org.jf.dexlib2.iface.instruction.WideLiteralInstruction; //导入依赖的package包/类
/**
 * Return the literal constant for this instruction.
 *
 * @param register the register number to fill
 * @param body the body containing the instruction
 */
private Constant getConstant(int dest, DexBody body) {

    long literal = 0;

    if (instruction instanceof WideLiteralInstruction) {
        literal = ((WideLiteralInstruction)instruction).getWideLiteral();
    } else if (instruction instanceof NarrowLiteralInstruction) {
        literal = ((NarrowLiteralInstruction)instruction).getNarrowLiteral();
    } else {
        throw new RuntimeException("literal error: expected narrow or wide literal.");
    }
    

    // floats are handled later in DexBody by calling DexNumtransformer
    Opcode opcode = instruction.getOpcode();
    switch (opcode) {
    case CONST:
    case CONST_4:
    case CONST_16:
        if (IDalvikTyper.ENABLE_DVKTYPER) {
            return UntypedIntOrFloatConstant.v((int)literal);
        } else {
            return IntConstant.v((int) literal);
        }

    case CONST_HIGH16:
        if (IDalvikTyper.ENABLE_DVKTYPER) {
            //
            //return UntypedIntOrFloatConstant.v((int)literal<<16).toFloatConstant();
            // seems that dexlib correctly puts the 16bits into the topmost bits.
            //
            return UntypedIntOrFloatConstant.v((int)literal);//.toFloatConstant();
        } else {
            return IntConstant.v((int) literal);
        }

    case CONST_WIDE_HIGH16:
        if (IDalvikTyper.ENABLE_DVKTYPER) {
            //return UntypedLongOrDoubleConstant.v((long)literal<<48).toDoubleConstant();
            // seems that dexlib correctly puts the 16bits into the topmost bits.
            //
            return UntypedLongOrDoubleConstant.v((long)literal);//.toDoubleConstant();
        } else {
        	return LongConstant.v(literal);
        }

    case CONST_WIDE:
    case CONST_WIDE_16:
    case CONST_WIDE_32:
        if (IDalvikTyper.ENABLE_DVKTYPER) {
            return UntypedLongOrDoubleConstant.v(literal);
        } else {
        	return LongConstant.v(literal);
        }
    default:
        throw new IllegalArgumentException("Expected a const or a const-wide instruction, got neither.");
    }
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:65,代码来源:ConstInstruction.java


注:本文中的org.jf.dexlib2.iface.instruction.WideLiteralInstruction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。