1
mirror of https://github.com/revanced/revanced-patcher synced 2025-09-10 05:30:49 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
semantic-release-bot
fa0412985c chore(release): 1.0.0-dev.8 [skip ci]
# [1.0.0-dev.8](https://github.com/ReVancedTeam/revanced-patcher/compare/v1.0.0-dev.7...v1.0.0-dev.8) (2022-03-24)

### Performance Improvements

* check type instead of class ([47eb493](47eb493f54))
2022-03-24 22:38:45 +00:00
Lucaskyy
0048788dd0 Merge remote-tracking branch 'origin/dev' into dev 2022-03-24 23:37:34 +01:00
Lucaskyy
47eb493f54 perf: check type instead of class
this is way better, thank you oSumAtrIX!
2022-03-24 23:37:28 +01:00
3 changed files with 11 additions and 10 deletions

View File

@@ -1,3 +1,10 @@
# [1.0.0-dev.8](https://github.com/ReVancedTeam/revanced-patcher/compare/v1.0.0-dev.7...v1.0.0-dev.8) (2022-03-24)
### Performance Improvements
* check type instead of class ([47eb493](https://github.com/ReVancedTeam/revanced-patcher/commit/47eb493f5425dc27a4d6e79e6b02a36ef760e8da))
# [1.0.0-dev.7](https://github.com/ReVancedTeam/revanced-patcher/compare/v1.0.0-dev.6...v1.0.0-dev.7) (2022-03-24)

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official
version = 1.0.0-dev.7
version = 1.0.0-dev.8

View File

@@ -129,13 +129,7 @@ private fun InsnList.scanFor(pattern: IntArray): ScanResult {
var occurrence = 0
while (i + occurrence < this.size()) {
val n = this[i + occurrence]
if (
!n.anyOf(
LabelNode::class.java,
LineNumberNode::class.java
) &&
n.opcode != pattern[occurrence]
) break
if (!n.shouldSkip() && n.opcode != pattern[occurrence]) break
if (++occurrence >= pattern.size) {
val current = i + occurrence
return ScanResult(true, current - pattern.size, current)
@@ -158,5 +152,5 @@ private fun Array<Type>.convertObjects(): Array<Type> {
return this.map { it.convertObject() }.toTypedArray()
}
private fun AbstractInsnNode.anyOf(vararg types: Class<*>): Boolean =
types.any { this@anyOf.javaClass == it }
private fun AbstractInsnNode.shouldSkip() =
type == AbstractInsnNode.LABEL || type == AbstractInsnNode.LINE