本文整理汇总了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());
}
示例2: writeCommentIfLikelyDouble
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction; //导入依赖的package包/类
protected void writeCommentIfLikelyDouble(IndentingWriter writer) throws IOException {
writeCommentIfLikelyDouble(writer, ((WideLiteralInstruction) instruction).getWideLiteral());
}
示例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.");
}
}