]> git.saurik.com Git - apple/icu.git/blame - icuSources/tools/toolutil/denseranges.h
ICU-62107.0.1.tar.gz
[apple/icu.git] / icuSources / tools / toolutil / denseranges.h
CommitLineData
f3c0d7a5
A
1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
4388f060
A
3/*
4*******************************************************************************
5* Copyright (C) 2010, International Business Machines
6* Corporation and others. All Rights Reserved.
7*******************************************************************************
8* file name: denseranges.h
f3c0d7a5 9* encoding: UTF-8
4388f060
A
10* tab size: 8 (not used)
11* indentation:4
12*
13* created on: 2010sep25
14* created by: Markus W. Scherer
15*
16* Helper code for finding a small number of dense ranges.
17*/
18
19#ifndef __DENSERANGES_H__
20#define __DENSERANGES_H__
21
22#include "unicode/utypes.h"
23
24/**
25 * Does it make sense to write 1..capacity ranges?
26 * Returns 0 if not, otherwise the number of ranges.
27 * @param values Sorted array of signed-integer values.
28 * @param length Number of values.
29 * @param density Minimum average range density, in 256th. (0x100=100%=perfectly dense.)
30 * Should be 0x80..0x100, must be 1..0x100.
31 * @param ranges Output ranges array.
32 * @param capacity Maximum number of ranges.
33 * @return Minimum number of ranges (at most capacity) that have the desired density,
34 * or 0 if that density cannot be achieved.
35 */
36U_CAPI int32_t U_EXPORT2
37uprv_makeDenseRanges(const int32_t values[], int32_t length,
38 int32_t density,
39 int32_t ranges[][2], int32_t capacity);
40
41#endif // __DENSERANGES_H__