Java Code Examples for com.android.dx.util.Hex#s4()
The following examples show how to use
com.android.dx.util.Hex#s4() .
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: CodeObserver.java From Box with Apache License 2.0 | 6 votes |
/** * Helper for {@link #visitConstant} where the constant is an * {@code int}. * * @param opcode the opcode * @param offset offset to the instruction * @param length instruction length * @param value constant value */ private void visitLiteralInt(int opcode, int offset, int length, int value) { String commentOrSpace = (length == 1) ? " // " : " "; String valueStr; opcode = bytes.getUnsignedByte(offset); // Compare with orig op below. if ((length == 1) || (opcode == ByteOps.BIPUSH)) { valueStr = "#" + Hex.s1(value); } else if (opcode == ByteOps.SIPUSH) { valueStr = "#" + Hex.s2(value); } else { valueStr = "#" + Hex.s4(value); } observer.parsed(bytes, offset, length, header(offset) + commentOrSpace + valueStr); }
Example 2
Source File: CodeObserver.java From Box with Apache License 2.0 | 6 votes |
/** * Helper for {@link #visitConstant} where the constant is an * {@code int}. * * @param opcode the opcode * @param offset offset to the instruction * @param length instruction length * @param value constant value */ private void visitLiteralInt(int opcode, int offset, int length, int value) { String commentOrSpace = (length == 1) ? " // " : " "; String valueStr; opcode = bytes.getUnsignedByte(offset); // Compare with orig op below. if ((length == 1) || (opcode == ByteOps.BIPUSH)) { valueStr = "#" + Hex.s1(value); } else if (opcode == ByteOps.SIPUSH) { valueStr = "#" + Hex.s2(value); } else { valueStr = "#" + Hex.s4(value); } observer.parsed(bytes, offset, length, header(offset) + commentOrSpace + valueStr); }
Example 3
Source File: CodeObserver.java From J2ME-Loader with Apache License 2.0 | 6 votes |
/** * Helper for {@link #visitConstant} where the constant is an * {@code int}. * * @param opcode the opcode * @param offset offset to the instruction * @param length instruction length * @param value constant value */ private void visitLiteralInt(int opcode, int offset, int length, int value) { String commentOrSpace = (length == 1) ? " // " : " "; String valueStr; opcode = bytes.getUnsignedByte(offset); // Compare with orig op below. if ((length == 1) || (opcode == ByteOps.BIPUSH)) { valueStr = "#" + Hex.s1(value); } else if (opcode == ByteOps.SIPUSH) { valueStr = "#" + Hex.s2(value); } else { valueStr = "#" + Hex.s4(value); } observer.parsed(bytes, offset, length, header(offset) + commentOrSpace + valueStr); }
Example 4
Source File: CodeObserver.java From buck with Apache License 2.0 | 6 votes |
/** * Helper for {@link #visitConstant} where the constant is an * {@code int}. * * @param opcode the opcode * @param offset offset to the instruction * @param length instruction length * @param value constant value */ private void visitLiteralInt(int opcode, int offset, int length, int value) { String commentOrSpace = (length == 1) ? " // " : " "; String valueStr; opcode = bytes.getUnsignedByte(offset); // Compare with orig op below. if ((length == 1) || (opcode == ByteOps.BIPUSH)) { valueStr = "#" + Hex.s1(value); } else if (opcode == ByteOps.SIPUSH) { valueStr = "#" + Hex.s2(value); } else { valueStr = "#" + Hex.s4(value); } observer.parsed(bytes, offset, length, header(offset) + commentOrSpace + valueStr); }
Example 5
Source File: InsnFormat.java From Box with Apache License 2.0 | 5 votes |
/** * Helper method to return the comment for a branch. * * @param insn {@code non-null;} the instruction in question * @return {@code non-null;} the comment */ protected static String branchComment(DalvInsn insn) { TargetInsn ti = (TargetInsn) insn; int offset = ti.getTargetOffset(); return (offset == (short) offset) ? Hex.s2(offset) : Hex.s4(offset); }
Example 6
Source File: DecodedInstruction.java From Box with Apache License 2.0 | 5 votes |
/** * Gets the target as a relative offset from the given base * address, as a code unit. This will throw if the value is out of * the range of a signed code unit. */ public final short getTargetUnit(int baseAddress) { int relativeTarget = getTarget(baseAddress); if (relativeTarget != (short) relativeTarget) { throw new DexException("Target out of range: " + Hex.s4(relativeTarget)); } return (short) relativeTarget; }
Example 7
Source File: DecodedInstruction.java From Box with Apache License 2.0 | 5 votes |
/** * Gets the target as a relative offset from the given base * address, masked to be a byte in size. This will throw if the * value is out of the range of a signed byte. */ public final int getTargetByte(int baseAddress) { int relativeTarget = getTarget(baseAddress); if (relativeTarget != (byte) relativeTarget) { throw new DexException("Target out of range: " + Hex.s4(relativeTarget)); } return relativeTarget & 0xff; }
Example 8
Source File: InsnFormat.java From Box with Apache License 2.0 | 5 votes |
/** * Helper method to return the comment for a branch. * * @param insn {@code non-null;} the instruction in question * @return {@code non-null;} the comment */ protected static String branchComment(DalvInsn insn) { TargetInsn ti = (TargetInsn) insn; int offset = ti.getTargetOffset(); return (offset == (short) offset) ? Hex.s2(offset) : Hex.s4(offset); }
Example 9
Source File: DecodedInstruction.java From Box with Apache License 2.0 | 5 votes |
/** * Gets the target as a relative offset from the given base * address, as a code unit. This will throw if the value is out of * the range of a signed code unit. */ public final short getTargetUnit(int baseAddress) { int relativeTarget = getTarget(baseAddress); if (relativeTarget != (short) relativeTarget) { throw new DexException("Target out of range: " + Hex.s4(relativeTarget)); } return (short) relativeTarget; }
Example 10
Source File: DecodedInstruction.java From Box with Apache License 2.0 | 5 votes |
/** * Gets the target as a relative offset from the given base * address, masked to be a byte in size. This will throw if the * value is out of the range of a signed byte. */ public final int getTargetByte(int baseAddress) { int relativeTarget = getTarget(baseAddress); if (relativeTarget != (byte) relativeTarget) { throw new DexException("Target out of range: " + Hex.s4(relativeTarget)); } return relativeTarget & 0xff; }
Example 11
Source File: InsnFormat.java From J2ME-Loader with Apache License 2.0 | 5 votes |
/** * Helper method to return the comment for a branch. * * @param insn {@code non-null;} the instruction in question * @return {@code non-null;} the comment */ protected static String branchComment(DalvInsn insn) { TargetInsn ti = (TargetInsn) insn; int offset = ti.getTargetOffset(); return (offset == (short) offset) ? Hex.s2(offset) : Hex.s4(offset); }
Example 12
Source File: DecodedInstruction.java From J2ME-Loader with Apache License 2.0 | 5 votes |
/** * Gets the target as a relative offset from the given base * address, as a code unit. This will throw if the value is out of * the range of a signed code unit. */ public final short getTargetUnit(int baseAddress) { int relativeTarget = getTarget(baseAddress); if (relativeTarget != (short) relativeTarget) { throw new DexException("Target out of range: " + Hex.s4(relativeTarget)); } return (short) relativeTarget; }
Example 13
Source File: DecodedInstruction.java From J2ME-Loader with Apache License 2.0 | 5 votes |
/** * Gets the target as a relative offset from the given base * address, masked to be a byte in size. This will throw if the * value is out of the range of a signed byte. */ public final int getTargetByte(int baseAddress) { int relativeTarget = getTarget(baseAddress); if (relativeTarget != (byte) relativeTarget) { throw new DexException("Target out of range: " + Hex.s4(relativeTarget)); } return relativeTarget & 0xff; }
Example 14
Source File: InsnFormat.java From buck with Apache License 2.0 | 5 votes |
/** * Helper method to return the comment for a branch. * * @param insn {@code non-null;} the instruction in question * @return {@code non-null;} the comment */ protected static String branchComment(DalvInsn insn) { TargetInsn ti = (TargetInsn) insn; int offset = ti.getTargetOffset(); return (offset == (short) offset) ? Hex.s2(offset) : Hex.s4(offset); }
Example 15
Source File: DecodedInstruction.java From buck with Apache License 2.0 | 5 votes |
/** * Gets the target as a relative offset from the given base * address, as a code unit. This will throw if the value is out of * the range of a signed code unit. */ public final short getTargetUnit(int baseAddress) { int relativeTarget = getTarget(baseAddress); if (relativeTarget != (short) relativeTarget) { throw new DexException("Target out of range: " + Hex.s4(relativeTarget)); } return (short) relativeTarget; }
Example 16
Source File: DecodedInstruction.java From buck with Apache License 2.0 | 5 votes |
/** * Gets the target as a relative offset from the given base * address, masked to be a byte in size. This will throw if the * value is out of the range of a signed byte. */ public final int getTargetByte(int baseAddress) { int relativeTarget = getTarget(baseAddress); if (relativeTarget != (byte) relativeTarget) { throw new DexException("Target out of range: " + Hex.s4(relativeTarget)); } return relativeTarget & 0xff; }