From e733b6500296b5a5843d68a19cadc7495f304664 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 21 Jan 2014 17:46:42 +0100 Subject: add support for index range search in multibin search MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/algorithms/searching/MultibinarySearch.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/algorithms/searching/MultibinarySearch.java b/src/algorithms/searching/MultibinarySearch.java index 0486af0..98ce3ff 100644 --- a/src/algorithms/searching/MultibinarySearch.java +++ b/src/algorithms/searching/MultibinarySearch.java @@ -150,9 +150,6 @@ public class MultibinarySearch */ public static £(fun "long[][]" indexOf "${T}[] items, ${Tarray} array, SortOrder order, SearchMode mode, int start, int end") { - if (mode == SearchMode.FIND_FIRST_AND_LAST) - throw new Error("Mode not implemented"); /* TODO */ - BinarySearch.SearchMode mode_ = mode == SearchMode.FIND_ANY ? BinarySearch.SearchMode.FIND_ANY : mode == SearchMode.FIND_FIRST ? BinarySearch.SearchMode.FIND_FIRST @@ -203,6 +200,8 @@ public class MultibinarySearch rc[1][rc_i++] = amax = (int)(£{bin_search}); if (amax < 0) amax = ~amax; + else if (mode == SearchMode.FIND_FIRST_AND_LAST) + amax >>= 32L; minomax[0][mm_i] = imax + 1; minomax[1][mm_i] = lastimax; -- cgit v1.2.3-70-g09d2