michael@0: /* michael@0: ******************************************************************************* michael@0: * Copyright (C) 2010, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: ******************************************************************************* michael@0: * file name: denseranges.h michael@0: * encoding: US-ASCII michael@0: * tab size: 8 (not used) michael@0: * indentation:4 michael@0: * michael@0: * created on: 2010sep25 michael@0: * created by: Markus W. Scherer michael@0: * michael@0: * Helper code for finding a small number of dense ranges. michael@0: */ michael@0: michael@0: #ifndef __DENSERANGES_H__ michael@0: #define __DENSERANGES_H__ michael@0: michael@0: #include "unicode/utypes.h" michael@0: michael@0: /** michael@0: * Does it make sense to write 1..capacity ranges? michael@0: * Returns 0 if not, otherwise the number of ranges. michael@0: * @param values Sorted array of signed-integer values. michael@0: * @param length Number of values. michael@0: * @param density Minimum average range density, in 256th. (0x100=100%=perfectly dense.) michael@0: * Should be 0x80..0x100, must be 1..0x100. michael@0: * @param ranges Output ranges array. michael@0: * @param capacity Maximum number of ranges. michael@0: * @return Minimum number of ranges (at most capacity) that have the desired density, michael@0: * or 0 if that density cannot be achieved. michael@0: */ michael@0: U_CAPI int32_t U_EXPORT2 michael@0: uprv_makeDenseRanges(const int32_t values[], int32_t length, michael@0: int32_t density, michael@0: int32_t ranges[][2], int32_t capacity); michael@0: michael@0: #endif // __DENSERANGES_H__