Java Code Examples for com.android.dx.util.Hex#u8()

The following examples show how to use com.android.dx.util.Hex#u8() . 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: DecodedInstruction.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the literal value, masked to be a nibble in size. This
 * will throw if the value is out of the range of a signed nibble.
 */
public final int getLiteralNibble() {
    if ((literal < -8) || (literal > 7)) {
        throw new DexException("Literal out of range: " + Hex.u8(literal));
    }

    return (int) literal & 0xf;
}
 
Example 2
Source File: DecodedInstruction.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the register count, as a code unit. This will throw if the
 * value is out of the range of an unsigned code unit.
 */
public final short getRegisterCountUnit() {
    int registerCount = getRegisterCount();

    if ((registerCount & ~0xffff) != 0) {
        throw new DexException("Register count out of range: "
                + Hex.u8(registerCount));
    }

    return (short) registerCount;
}
 
Example 3
Source File: DecodedInstruction.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the literal value, as a code unit. This will throw if the
 * value is out of the range of a signed code unit.
 */
public final short getLiteralUnit() {
    if (literal != (short) literal) {
        throw new DexException("Literal out of range: " + Hex.u8(literal));
    }

    return (short) literal;
}
 
Example 4
Source File: DecodedInstruction.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the C register number, as a nibble. This will throw if the
 * value is out of the range of an unsigned nibble.
 */
public final short getCNibble() {
    int c = getC();

    if ((c & ~0xf) != 0) {
        throw new DexException("Register C out of range: " + Hex.u8(c));
    }

    return (short) c;
}
 
Example 5
Source File: DecodedInstruction.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the C register number, as a byte. This will throw if the
 * value is out of the range of an unsigned byte.
 */
public final short getCByte() {
    int c = getC();

    if ((c & ~0xff) != 0) {
        throw new DexException("Register C out of range: " + Hex.u8(c));
    }

    return (short) c;
}
 
Example 6
Source File: DecodedInstruction.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the A register number, as a code unit. This will throw if the
 * value is out of the range of an unsigned code unit.
 */
public final short getAUnit() {
    int a = getA();

    if ((a & ~0xffff) != 0) {
        throw new DexException("Register A out of range: " + Hex.u8(a));
    }

    return (short) a;
}
 
Example 7
Source File: DecodedInstruction.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the D register number, as a nibble. This will throw if the
 * value is out of the range of an unsigned nibble.
 */
public final short getDNibble() {
    int d = getD();

    if ((d & ~0xf) != 0) {
        throw new DexException("Register D out of range: " + Hex.u8(d));
    }

    return (short) d;
}
 
Example 8
Source File: DecodedInstruction.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the B register number, as a byte. This will throw if the
 * value is out of the range of an unsigned byte.
 */
public final short getBByte() {
    int b = getB();

    if ((b & ~0xff) != 0) {
        throw new DexException("Register B out of range: " + Hex.u8(b));
    }

    return (short) b;
}
 
Example 9
Source File: DecodedInstruction.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the B register number, as a byte. This will throw if the
 * value is out of the range of an unsigned byte.
 */
public final short getBByte() {
    int b = getB();

    if ((b & ~0xff) != 0) {
        throw new DexException("Register B out of range: " + Hex.u8(b));
    }

    return (short) b;
}
 
Example 10
Source File: DecodedInstruction.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the B register number, as a byte. This will throw if the
 * value is out of the range of an unsigned byte.
 */
public final short getBByte() {
    int b = getB();

    if ((b & ~0xff) != 0) {
        throw new DexException("Register B out of range: " + Hex.u8(b));
    }

    return (short) b;
}
 
Example 11
Source File: DecodedInstruction.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the E register number, as a nibble. This will throw if the
 * value is out of the range of an unsigned nibble.
 */
public final short getENibble() {
    int e = getE();

    if ((e & ~0xf) != 0) {
        throw new DexException("Register E out of range: " + Hex.u8(e));
    }

    return (short) e;
}
 
Example 12
Source File: DecodedInstruction.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the register count, as a code unit. This will throw if the
 * value is out of the range of an unsigned code unit.
 */
public final short getRegisterCountUnit() {
    int registerCount = getRegisterCount();

    if ((registerCount & ~0xffff) != 0) {
        throw new DexException("Register count out of range: "
                + Hex.u8(registerCount));
    }

    return (short) registerCount;
}
 
Example 13
Source File: DecodedInstruction.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the E register number, as a nibble. This will throw if the
 * value is out of the range of an unsigned nibble.
 */
public final short getENibble() {
    int e = getE();

    if ((e & ~0xf) != 0) {
        throw new DexException("Register E out of range: " + Hex.u8(e));
    }

    return (short) e;
}
 
Example 14
Source File: DecodedInstruction.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the A register number, as a byte. This will throw if the
 * value is out of the range of an unsigned byte.
 */
public final short getAByte() {
    int a = getA();

    if ((a & ~0xff) != 0) {
        throw new DexException("Register A out of range: " + Hex.u8(a));
    }

    return (short) a;
}
 
Example 15
Source File: DecodedInstruction.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the A register number, as a nibble. This will throw if the
 * value is out of the range of an unsigned nibble.
 */
public final short getANibble() {
    int a = getA();

    if ((a & ~0xf) != 0) {
        throw new DexException("Register A out of range: " + Hex.u8(a));
    }

    return (short) a;
}
 
Example 16
Source File: DecodedInstruction.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the A register number, as a nibble. This will throw if the
 * value is out of the range of an unsigned nibble.
 */
public final short getANibble() {
    int a = getA();

    if ((a & ~0xf) != 0) {
        throw new DexException("Register A out of range: " + Hex.u8(a));
    }

    return (short) a;
}
 
Example 17
Source File: DecodedInstruction.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the B register number, as a code unit. This will throw if the
 * value is out of the range of an unsigned code unit.
 */
public final short getBUnit() {
    int b = getB();

    if ((b & ~0xffff) != 0) {
        throw new DexException("Register B out of range: " + Hex.u8(b));
    }

    return (short) b;
}
 
Example 18
Source File: DecodedInstruction.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the C register number, as a nibble. This will throw if the
 * value is out of the range of an unsigned nibble.
 */
public final short getCNibble() {
    int c = getC();

    if ((c & ~0xf) != 0) {
        throw new DexException("Register C out of range: " + Hex.u8(c));
    }

    return (short) c;
}
 
Example 19
Source File: CodeObserver.java    From Box with Apache License 2.0 3 votes vote down vote up
/**
 * Helper for {@link #visitConstant} where the constant is a
 * {@code double}.
 *
 * @param opcode the opcode
 * @param offset offset to the instruction
 * @param length instruction length
 * @param bits constant value, as double-bits
 */
private void visitLiteralDouble(int opcode, int offset, int length,
        long bits) {
    String optArg = (length != 1) ? " #" + Hex.u8(bits) : "";

    observer.parsed(bytes, offset, length,
                    header(offset) + optArg + " // " +
                    Double.longBitsToDouble(bits));
}
 
Example 20
Source File: CodeObserver.java    From Box with Apache License 2.0 3 votes vote down vote up
/**
 * Helper for {@link #visitConstant} where the constant is a
 * {@code double}.
 *
 * @param opcode the opcode
 * @param offset offset to the instruction
 * @param length instruction length
 * @param bits constant value, as double-bits
 */
private void visitLiteralDouble(int opcode, int offset, int length,
        long bits) {
    String optArg = (length != 1) ? " #" + Hex.u8(bits) : "";

    observer.parsed(bytes, offset, length,
                    header(offset) + optArg + " // " +
                    Double.longBitsToDouble(bits));
}