mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 21:27:43 +02:00
build(revanced-patcher): bump version
This commit is contained in:
30
src/main/kotlin/app/revanced/util/bytecode/BytecodeUtils.kt
Normal file
30
src/main/kotlin/app/revanced/util/bytecode/BytecodeUtils.kt
Normal file
@ -0,0 +1,30 @@
|
||||
package app.revanced.util.bytecode
|
||||
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.Method
|
||||
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||
|
||||
fun Method.getNarrowLiteralIndex(value: Int): Int {
|
||||
return implementation?.let {
|
||||
it.instructions.indexOfFirst { instruction ->
|
||||
instruction.opcode == Opcode.CONST && (instruction as NarrowLiteralInstruction).narrowLiteral == value
|
||||
}
|
||||
} ?: -1
|
||||
}
|
||||
|
||||
fun Method.isNarrowLiteralExists(value: Int): Boolean {
|
||||
return getNarrowLiteralIndex(value) != -1
|
||||
}
|
||||
|
||||
fun Method.getWideLiteralIndex(value: Long): Int {
|
||||
return implementation?.let {
|
||||
it.instructions.indexOfFirst { instruction ->
|
||||
instruction.opcode == Opcode.CONST && (instruction as WideLiteralInstruction).wideLiteral == value
|
||||
}
|
||||
} ?: -1
|
||||
}
|
||||
|
||||
fun Method.isWideLiteralExists(value: Long): Boolean {
|
||||
return getWideLiteralIndex(value) != -1
|
||||
}
|
Reference in New Issue
Block a user