X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2Ficu%2Fsource%2Fcommon%2Fuarrsort.h;h=aece6da939ac09f3ecd8e83bb84f27e2751bd937;hb=4a1a0bdd01eef90b0826a0e761d3379d3715c10f;hp=b9a580c7e22a84b3d268a0bf9fe4a44a11242a45;hpb=b1be5ca53587d23e7aeb77b26861fdc0a181ffd8;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/icu/source/common/uarrsort.h b/src/third_party/icu/source/common/uarrsort.h index b9a580c..aece6da 100644 --- a/src/third_party/icu/source/common/uarrsort.h +++ b/src/third_party/icu/source/common/uarrsort.h @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 2003, International Business Machines +* Copyright (C) 2003-2013, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -81,4 +81,21 @@ uprv_int32Comparator(const void *context, const void *left, const void *right); U_CAPI int32_t U_EXPORT2 uprv_uint32Comparator(const void *context, const void *left, const void *right); +/** + * Much like Java Collections.binarySearch(list, key, comparator). + * + * Except: Java documents "If the list contains multiple elements equal to + * the specified object, there is no guarantee which one will be found." + * + * This version here will return the largest index of any equal item, + * for use in stable sorting. + * + * @return the index>=0 where the item was found: + * the largest such index, if multiple, for stable sorting; + * or the index<0 for inserting the item at ~index in sorted order + */ +U_CAPI int32_t U_EXPORT2 +uprv_stableBinarySearch(char *array, int32_t length, void *item, int32_t itemSize, + UComparator *cmp, const void *context); + #endif