[jruby-joni] 137/194: dedup exact n ops

Hideki Yamane henrich at moszumanska.debian.org
Thu Feb 1 12:04:35 UTC 2018


This is an automated email from the git hooks/post-receive script.

henrich pushed a commit to branch debian/sid
in repository jruby-joni.

commit c7668fba32ebb783406e7ea3e1afee70ad0bdd41
Author: Marcin Mielzynski <lopx at gazeta.pl>
Date:   Wed Jan 10 17:19:10 2018 +0100

    dedup exact n ops
---
 src/org/joni/ByteCodeMachine.java | 70 +++++++++++++++++----------------------
 1 file changed, 30 insertions(+), 40 deletions(-)

diff --git a/src/org/joni/ByteCodeMachine.java b/src/org/joni/ByteCodeMachine.java
index 16308c9..4c76bdf 100644
--- a/src/org/joni/ByteCodeMachine.java
+++ b/src/org/joni/ByteCodeMachine.java
@@ -537,58 +537,48 @@ class ByteCodeMachine extends StackMachine {
     }
 
     private void opExact1() {
-        if (s >= range || code[ip] != bytes[s++]) {opFail(); return;}
-        //if (s > range) {opFail(); return;}
-        ip++;
-        sprev = sbegin; // break;
+        if (s >= range || code[ip] != bytes[s]) {
+            opFail();
+        } else {
+            ip++; s++;
+            sprev = sbegin; // break;
+        }
     }
 
     private void opExact2() {
-        if (s + 2 > range) {opFail(); return;}
-        if (code[ip] != bytes[s]) {opFail(); return;}
-        ip++; s++;
-        if (code[ip] != bytes[s]) {opFail(); return;}
-        sprev = s;
-        ip++; s++;
+        if (s + 2 > range || code[ip++] != bytes[s++] || code[ip] != bytes[s] ) {
+            opFail();
+        } else {
+            sprev = s;
+            ip++; s++;
+        }
     }
 
     private void opExact3() {
-        if (s + 3 > range) {opFail(); return;}
-        if (code[ip] != bytes[s]) {opFail(); return;}
-        ip++; s++;
-        if (code[ip] != bytes[s]) {opFail(); return;}
-        ip++; s++;
-        if (code[ip] != bytes[s]) {opFail(); return;}
-        sprev = s;
-        ip++; s++;
+        if (s + 3 > range || code[ip++] != bytes[s++] || code[ip++] != bytes[s++] || code[ip] != bytes[s]) {
+            opFail();
+        } else {
+            sprev = s;
+            ip++; s++;
+        }
     }
 
     private void opExact4() {
-        if (s + 4 > range) {opFail(); return;}
-        if (code[ip] != bytes[s]) {opFail(); return;}
-        ip++; s++;
-        if (code[ip] != bytes[s]) {opFail(); return;}
-        ip++; s++;
-        if (code[ip] != bytes[s]) {opFail(); return;}
-        ip++; s++;
-        if (code[ip] != bytes[s]) {opFail(); return;}
-        sprev = s;
-        ip++; s++;
+        if (s + 4 > range || code[ip++] != bytes[s++] || code[ip++] != bytes[s++] || code[ip++] != bytes[s++] || code[ip] != bytes[s]) {
+            opFail();
+        } else {
+            sprev = s;
+            ip++; s++;
+        }
     }
 
     private void opExact5() {
-        if (s + 5 > range) {opFail(); return;}
-        if (code[ip] != bytes[s]) {opFail(); return;}
-        ip++; s++;
-        if (code[ip] != bytes[s]) {opFail(); return;}
-        ip++; s++;
-        if (code[ip] != bytes[s]) {opFail(); return;}
-        ip++; s++;
-        if (code[ip] != bytes[s]) {opFail(); return;}
-        ip++; s++;
-        if (code[ip] != bytes[s]) {opFail(); return;}
-        sprev = s;
-        ip++; s++;
+        if (s + 5 > range || code[ip++] != bytes[s++] || code[ip++] != bytes[s++] || code[ip++] != bytes[s++] || code[ip++] != bytes[s++] || code[ip] != bytes[s]) {
+            opFail();
+        } else {
+            sprev = s;
+            ip++; s++;
+        }
     }
 
     private void opExactN() {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jruby-joni.git



More information about the pkg-java-commits mailing list