aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-01-21 17:56:22 +0100
committerMattias Andrée <maandree@operamail.com>2014-01-21 17:56:22 +0100
commitdf556f0de2a26a24c6e4bae353854762d86b7afc (patch)
treebbd2df574d5da4932ddb1b868234202f554a3d87
parentadd support for index range search in multibin search (diff)
downloadalgorithms-and-data-structures-df556f0de2a26a24c6e4bae353854762d86b7afc.tar.gz
algorithms-and-data-structures-df556f0de2a26a24c6e4bae353854762d86b7afc.tar.bz2
algorithms-and-data-structures-df556f0de2a26a24c6e4bae353854762d86b7afc.tar.xz
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/algorithms/searching/MultibinarySearch.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/algorithms/searching/MultibinarySearch.java b/src/algorithms/searching/MultibinarySearch.java
index 98ce3ff..2b473a1 100644
--- a/src/algorithms/searching/MultibinarySearch.java
+++ b/src/algorithms/searching/MultibinarySearch.java
@@ -197,11 +197,13 @@ public class MultibinarySearch
lastimax = imax;
lastamax = amax;
rc[0][rc_i] = imax = imin + ((imax - imin) >>> 1);
- rc[1][rc_i++] = amax = (int)(£{bin_search});
+ amax = (int)(rc[1][rc_i++] = £{bin_search});
if (amax < 0)
amax = ~amax;
+ /* This is possible to do, but you will probably lose performance:
else if (mode == SearchMode.FIND_FIRST_AND_LAST)
- amax >>= 32L;
+ amax = (int)(rc[1][rc_i - 1] >> 32L);
+ */
minomax[0][mm_i] = imax + 1;
minomax[1][mm_i] = lastimax;