diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-01-21 17:56:22 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-01-21 17:56:22 +0100 |
commit | df556f0de2a26a24c6e4bae353854762d86b7afc (patch) | |
tree | bbd2df574d5da4932ddb1b868234202f554a3d87 /src/algorithms/searching | |
parent | add support for index range search in multibin search (diff) | |
download | algorithms-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>
Diffstat (limited to 'src/algorithms/searching')
-rw-r--r-- | src/algorithms/searching/MultibinarySearch.java | 6 |
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; |