[jruby-joni] 172/194: sync code range buffer
Hideki Yamane
henrich at moszumanska.debian.org
Thu Feb 1 12:04:38 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 40b689c582448f6e473334fd4539f66b73b22f12
Author: Marcin Mielzynski <lopx at gazeta.pl>
Date: Tue Jan 16 22:33:16 2018 +0100
sync code range buffer
---
src/org/joni/CodeRangeBuffer.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/org/joni/CodeRangeBuffer.java b/src/org/joni/CodeRangeBuffer.java
index 85bb029..e046f03 100644
--- a/src/org/joni/CodeRangeBuffer.java
+++ b/src/org/joni/CodeRangeBuffer.java
@@ -107,12 +107,11 @@ public final class CodeRangeBuffer {
int[]p = pbuf.p;
int n = p[0];
+ int bound = from == 0 ? 0 : n;
int low = 0;
- int bound = n;
-
while (low < bound) {
int x = (low + bound) >>> 1;
- if (from > p[x * 2 + 2]) {
+ if (from - 1 > p[x * 2 + 2]) {
low = x + 1;
} else {
bound = x;
@@ -121,10 +120,9 @@ public final class CodeRangeBuffer {
int high = low;
bound = n;
-
while (high < bound) {
int x = (high + bound) >>> 1;
- if (to >= p[x * 2 + 1] - 1) {
+ if (to >= p[x * 2 + 1] - 1) { // to + 1
high = x + 1;
} else {
bound = x;
@@ -140,13 +138,15 @@ public final class CodeRangeBuffer {
if (to < p[(high - 1) * 2 + 2]) to = p[(high - 1) * 2 + 2];
}
- if (incN != 0 && high < n) {
+ if (incN != 0) {
int fromPos = 1 + high * 2;
int toPos = 1 + (low + 1) * 2;
- int size = (n - high) * 2;
if (incN > 0) {
- pbuf.moveRight(fromPos, toPos, size);
+ if (high < n) {
+ int size = (n - high) * 2;
+ pbuf.moveRight(fromPos, toPos, size);
+ }
} else {
pbuf.moveLeftAndReduce(fromPos, toPos);
}
--
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