1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/tools/toolutil/denseranges.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,39 @@ 1.4 +/* 1.5 +******************************************************************************* 1.6 +* Copyright (C) 2010, International Business Machines 1.7 +* Corporation and others. All Rights Reserved. 1.8 +******************************************************************************* 1.9 +* file name: denseranges.h 1.10 +* encoding: US-ASCII 1.11 +* tab size: 8 (not used) 1.12 +* indentation:4 1.13 +* 1.14 +* created on: 2010sep25 1.15 +* created by: Markus W. Scherer 1.16 +* 1.17 +* Helper code for finding a small number of dense ranges. 1.18 +*/ 1.19 + 1.20 +#ifndef __DENSERANGES_H__ 1.21 +#define __DENSERANGES_H__ 1.22 + 1.23 +#include "unicode/utypes.h" 1.24 + 1.25 +/** 1.26 + * Does it make sense to write 1..capacity ranges? 1.27 + * Returns 0 if not, otherwise the number of ranges. 1.28 + * @param values Sorted array of signed-integer values. 1.29 + * @param length Number of values. 1.30 + * @param density Minimum average range density, in 256th. (0x100=100%=perfectly dense.) 1.31 + * Should be 0x80..0x100, must be 1..0x100. 1.32 + * @param ranges Output ranges array. 1.33 + * @param capacity Maximum number of ranges. 1.34 + * @return Minimum number of ranges (at most capacity) that have the desired density, 1.35 + * or 0 if that density cannot be achieved. 1.36 + */ 1.37 +U_CAPI int32_t U_EXPORT2 1.38 +uprv_makeDenseRanges(const int32_t values[], int32_t length, 1.39 + int32_t density, 1.40 + int32_t ranges[][2], int32_t capacity); 1.41 + 1.42 +#endif // __DENSERANGES_H__