Skip to content

Commit

Permalink
fix: current must be calculated after increment
Browse files Browse the repository at this point in the history
  • Loading branch information
Sculas committed Mar 20, 2022
1 parent ec8115f commit 5f12bab
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ private fun InsnList.scanFor(pattern: Array<Int>): ScanResult {
for (i in 0 until this.size()) {
var occurrence = 0
while (i + occurrence < this.size()) {
val current = i + occurrence
if (this[current].opcode != pattern[occurrence]) break
if (this[i + occurrence].opcode != pattern[occurrence]) break
if (++occurrence >= pattern.size) {
val current = i + occurrence
return ScanResult(true, current - pattern.size, current)
}
}
Expand Down

0 comments on commit 5f12bab

Please sign in to comment.