Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / icu / source / tools / toolutil / denseranges.h
1 /*
2 *******************************************************************************
3 *   Copyright (C) 2010, International Business Machines
4 *   Corporation and others.  All Rights Reserved.
5 *******************************************************************************
6 *   file name:  denseranges.h
7 *   encoding:   US-ASCII
8 *   tab size:   8 (not used)
9 *   indentation:4
10 *
11 *   created on: 2010sep25
12 *   created by: Markus W. Scherer
13 *
14 * Helper code for finding a small number of dense ranges.
15 */
16
17 #ifndef __DENSERANGES_H__
18 #define __DENSERANGES_H__
19
20 #include "unicode/utypes.h"
21
22 /**
23  * Does it make sense to write 1..capacity ranges?
24  * Returns 0 if not, otherwise the number of ranges.
25  * @param values Sorted array of signed-integer values.
26  * @param length Number of values.
27  * @param density Minimum average range density, in 256th. (0x100=100%=perfectly dense.)
28  *                Should be 0x80..0x100, must be 1..0x100.
29  * @param ranges Output ranges array.
30  * @param capacity Maximum number of ranges.
31  * @return Minimum number of ranges (at most capacity) that have the desired density,
32  *         or 0 if that density cannot be achieved.
33  */
34 U_CAPI int32_t U_EXPORT2
35 uprv_makeDenseRanges(const int32_t values[], int32_t length,
36                      int32_t density,
37                      int32_t ranges[][2], int32_t capacity);
38
39 #endif  // __DENSERANGES_H__