aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Stocker2010-10-28 11:37:21 -0400
committerRobin Stocker2010-10-28 11:37:21 -0400
commitdb35d91fa6ca6339f58149cf45cb02555987123b (patch)
tree6ee0c6dcec765041ee9ef90fddb7fa2fa4432256
parent79ca8a2d19fb536c15219a1856aa23b00e9344ff (diff)
downloadjgit-db35d91fa6ca6339f58149cf45cb02555987123b.zip
jgit-db35d91fa6ca6339f58149cf45cb02555987123b.tar.gz
jgit-db35d91fa6ca6339f58149cf45cb02555987123b.tar.xz
Fix oddness check in MyersDiff for negative numbers
It's probably not possible that these numbers are negative in the algorithm, but it's cleaner this way and gets rid of three more FindBugs warnings. Change-Id: Ifbce4e2c787fb9a7cd309c605e8d86211ef8a352
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java
index 3459109..9d309d5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java
@@ -300,7 +300,7 @@ public class MyersDiff<S extends Sequence> {
final int getIndex(int d, int k) {
// TODO: remove
-if (((d + k - middleK) % 2) == 1)
+if (((d + k - middleK) % 2) != 0)
throw new RuntimeException(MessageFormat.format(JGitText.get().unexpectedOddResult, d, k, middleK));
return (d + k - middleK) / 2;
}
@@ -472,7 +472,7 @@ if (k < beginK || k > endK)
if (k < backward.beginK || k > backward.endK)
return false;
// TODO: move out of loop
- if (((d - 1 + k - backward.middleK) % 2) == 1)
+ if (((d - 1 + k - backward.middleK) % 2) != 0)
return false;
if (x < backward.getX(d - 1, k))
return false;
@@ -514,7 +514,7 @@ if (k < beginK || k > endK)
if (k < forward.beginK || k > forward.endK)
return false;
// TODO: move out of loop
- if (((d + k - forward.middleK) % 2) == 1)
+ if (((d + k - forward.middleK) % 2) != 0)
return false;
if (x > forward.getX(d, k))
return false;