# HG changeset patch # User Raimund Renkert # Date 1340204609 0 # Node ID fe9be7ccc5e887bd7d7eb3ac2d2c5cb11245ec1f # Parent 070b76fbae46bb639e2a7cbc18aa409949edb7aa Fixed binary search in Parameters. flys-artifacts/trunk@4727 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 070b76fbae46 -r fe9be7ccc5e8 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Wed Jun 20 14:24:52 2012 +0000 +++ b/flys-artifacts/ChangeLog Wed Jun 20 15:03:29 2012 +0000 @@ -1,3 +1,8 @@ +2012-06-20 Raimund Renkert + + * src/main/java/de/intevation/flys/artifacts/model/Parameters.java: + Fixed binary search. + 2012-06-20 Sascha L. Teichmann * src/main/java/de/intevation/flys/artifacts/model/Parameters.java: diff -r 070b76fbae46 -r fe9be7ccc5e8 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Parameters.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Parameters.java Wed Jun 20 14:24:52 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Parameters.java Wed Jun 20 15:03:29 2012 +0000 @@ -164,11 +164,11 @@ TDoubleArrayList column = columns[columnIndex]; int lo = 0, hi = column.size()-1; - while (lo <= hi) { - int mid = (lo + hi) >>> 1; + while (hi >= lo) { + int mid = (lo + hi) >> 1; double v = column.getQuick(mid); - if (v < vl) hi = mid - 1; - else if (v > vh) lo = mid + 1; + if (v < vl) lo = mid + 1; + else if (v > vh) hi = mid - 1; else return mid; }