mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-04 14:34:25 +02:00
perf: check type instead of class
this is way better, thank you oSumAtrIX!
This commit is contained in:
parent
fa6e454ae9
commit
c7ef2644d8
@ -129,13 +129,7 @@ private fun InsnList.scanFor(pattern: IntArray): ScanResult {
|
|||||||
var occurrence = 0
|
var occurrence = 0
|
||||||
while (i + occurrence < this.size()) {
|
while (i + occurrence < this.size()) {
|
||||||
val n = this[i + occurrence]
|
val n = this[i + occurrence]
|
||||||
if (
|
if (!n.shouldSkip() && n.opcode != pattern[occurrence]) break
|
||||||
!n.anyOf(
|
|
||||||
LabelNode::class.java,
|
|
||||||
LineNumberNode::class.java
|
|
||||||
) &&
|
|
||||||
n.opcode != pattern[occurrence]
|
|
||||||
) break
|
|
||||||
if (++occurrence >= pattern.size) {
|
if (++occurrence >= pattern.size) {
|
||||||
val current = i + occurrence
|
val current = i + occurrence
|
||||||
return ScanResult(true, current - pattern.size, current)
|
return ScanResult(true, current - pattern.size, current)
|
||||||
@ -158,5 +152,5 @@ private fun Array<Type>.convertObjects(): Array<Type> {
|
|||||||
return this.map { it.convertObject() }.toTypedArray()
|
return this.map { it.convertObject() }.toTypedArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun AbstractInsnNode.anyOf(vararg types: Class<*>): Boolean =
|
private fun AbstractInsnNode.shouldSkip() =
|
||||||
types.any { this@anyOf.javaClass == it }
|
type == AbstractInsnNode.LABEL || type == AbstractInsnNode.LINE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user