com.android.dx.rop.cst.CstLiteral64 Java Examples

The following examples show how to use com.android.dx.rop.cst.CstLiteral64. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Form51l.java    From Box with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public boolean isCompatible(DalvInsn insn) {
    RegisterSpecList regs = insn.getRegisters();
    if (!((insn instanceof CstInsn) &&
          (regs.size() == 1) &&
          unsignedFitsInByte(regs.get(0).getReg()))) {
        return false;
    }

    CstInsn ci = (CstInsn) insn;
    Constant cst = ci.getConstant();

    return (cst instanceof CstLiteral64);
}
 
Example #2
Source File: Form51l.java    From Box with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeTo(AnnotatedOutput out, DalvInsn insn) {
    RegisterSpecList regs = insn.getRegisters();
    long value =
        ((CstLiteral64) ((CstInsn) insn).getConstant()).getLongBits();

    write(out, opcodeUnit(insn, regs.get(0).getReg()), value);
}
 
Example #3
Source File: InsnFormat.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to return a literal bits comment string.
 *
 * @param value the value
 * @param width the width of the constant, in bits (used for displaying
 * the uninterpreted bits; one of: {@code 4 8 16 32 64}
 * @return {@code non-null;} the comment
 */
protected static String literalBitsComment(CstLiteralBits value,
        int width) {
    StringBuilder sb = new StringBuilder(20);

    sb.append("#");

    long bits;

    if (value instanceof CstLiteral64) {
        bits = ((CstLiteral64) value).getLongBits();
    } else {
        bits = value.getIntBits();
    }

    switch (width) {
        case 4:  sb.append(Hex.uNibble((int) bits)); break;
        case 8:  sb.append(Hex.u1((int) bits));      break;
        case 16: sb.append(Hex.u2((int) bits));      break;
        case 32: sb.append(Hex.u4((int) bits));      break;
        case 64: sb.append(Hex.u8(bits));            break;
        default: {
            throw new RuntimeException("shouldn't happen");
        }
    }

    return sb.toString();
}
 
Example #4
Source File: Form51l.java    From Box with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public boolean isCompatible(DalvInsn insn) {
    RegisterSpecList regs = insn.getRegisters();
    if (!((insn instanceof CstInsn) &&
          (regs.size() == 1) &&
          unsignedFitsInByte(regs.get(0).getReg()))) {
        return false;
    }

    CstInsn ci = (CstInsn) insn;
    Constant cst = ci.getConstant();

    return (cst instanceof CstLiteral64);
}
 
Example #5
Source File: Form51l.java    From Box with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeTo(AnnotatedOutput out, DalvInsn insn) {
    RegisterSpecList regs = insn.getRegisters();
    long value =
        ((CstLiteral64) ((CstInsn) insn).getConstant()).getLongBits();

    write(out, opcodeUnit(insn, regs.get(0).getReg()), value);
}
 
Example #6
Source File: InsnFormat.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to return a literal bits comment string.
 *
 * @param value the value
 * @param width the width of the constant, in bits (used for displaying
 * the uninterpreted bits; one of: {@code 4 8 16 32 64}
 * @return {@code non-null;} the comment
 */
protected static String literalBitsComment(CstLiteralBits value,
        int width) {
    StringBuilder sb = new StringBuilder(20);

    sb.append("#");

    long bits;

    if (value instanceof CstLiteral64) {
        bits = ((CstLiteral64) value).getLongBits();
    } else {
        bits = value.getIntBits();
    }

    switch (width) {
        case 4:  sb.append(Hex.uNibble((int) bits)); break;
        case 8:  sb.append(Hex.u1((int) bits));      break;
        case 16: sb.append(Hex.u2((int) bits));      break;
        case 32: sb.append(Hex.u4((int) bits));      break;
        case 64: sb.append(Hex.u8(bits));            break;
        default: {
            throw new RuntimeException("shouldn't happen");
        }
    }

    return sb.toString();
}
 
Example #7
Source File: Form51l.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public boolean isCompatible(DalvInsn insn) {
    RegisterSpecList regs = insn.getRegisters();
    if (!((insn instanceof CstInsn) &&
          (regs.size() == 1) &&
          unsignedFitsInByte(regs.get(0).getReg()))) {
        return false;
    }

    CstInsn ci = (CstInsn) insn;
    Constant cst = ci.getConstant();

    return (cst instanceof CstLiteral64);
}
 
Example #8
Source File: Form51l.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeTo(AnnotatedOutput out, DalvInsn insn) {
    RegisterSpecList regs = insn.getRegisters();
    long value =
        ((CstLiteral64) ((CstInsn) insn).getConstant()).getLongBits();

    write(out, opcodeUnit(insn, regs.get(0).getReg()), value);
}
 
Example #9
Source File: InsnFormat.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to return a literal bits comment string.
 *
 * @param value the value
 * @param width the width of the constant, in bits (used for displaying
 * the uninterpreted bits; one of: {@code 4 8 16 32 64}
 * @return {@code non-null;} the comment
 */
protected static String literalBitsComment(CstLiteralBits value,
        int width) {
    StringBuffer sb = new StringBuffer(20);

    sb.append("#");

    long bits;

    if (value instanceof CstLiteral64) {
        bits = ((CstLiteral64) value).getLongBits();
    } else {
        bits = value.getIntBits();
    }

    switch (width) {
        case 4:  sb.append(Hex.uNibble((int) bits)); break;
        case 8:  sb.append(Hex.u1((int) bits));      break;
        case 16: sb.append(Hex.u2((int) bits));      break;
        case 32: sb.append(Hex.u4((int) bits));      break;
        case 64: sb.append(Hex.u8(bits));            break;
        default: {
            throw new RuntimeException("shouldn't happen");
        }
    }

    return sb.toString();
}
 
Example #10
Source File: Form51l.java    From buck with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public boolean isCompatible(DalvInsn insn) {
    RegisterSpecList regs = insn.getRegisters();
    if (!((insn instanceof CstInsn) &&
          (regs.size() == 1) &&
          unsignedFitsInByte(regs.get(0).getReg()))) {
        return false;
    }

    CstInsn ci = (CstInsn) insn;
    Constant cst = ci.getConstant();

    return (cst instanceof CstLiteral64);
}
 
Example #11
Source File: Form51l.java    From buck with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeTo(AnnotatedOutput out, DalvInsn insn) {
    RegisterSpecList regs = insn.getRegisters();
    long value =
        ((CstLiteral64) ((CstInsn) insn).getConstant()).getLongBits();

    write(out, opcodeUnit(insn, regs.get(0).getReg()), value);
}
 
Example #12
Source File: InsnFormat.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to return a literal bits comment string.
 *
 * @param value the value
 * @param width the width of the constant, in bits (used for displaying
 * the uninterpreted bits; one of: {@code 4 8 16 32 64}
 * @return {@code non-null;} the comment
 */
protected static String literalBitsComment(CstLiteralBits value,
        int width) {
    StringBuffer sb = new StringBuffer(20);

    sb.append("#");

    long bits;

    if (value instanceof CstLiteral64) {
        bits = ((CstLiteral64) value).getLongBits();
    } else {
        bits = value.getIntBits();
    }

    switch (width) {
        case 4:  sb.append(Hex.uNibble((int) bits)); break;
        case 8:  sb.append(Hex.u1((int) bits));      break;
        case 16: sb.append(Hex.u2((int) bits));      break;
        case 32: sb.append(Hex.u4((int) bits));      break;
        case 64: sb.append(Hex.u8(bits));            break;
        default: {
            throw new RuntimeException("shouldn't happen");
        }
    }

    return sb.toString();
}