denseranges.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // © 2016 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. /*
  4. *******************************************************************************
  5. * Copyright (C) 2010, International Business Machines
  6. * Corporation and others. All Rights Reserved.
  7. *******************************************************************************
  8. * file name: denseranges.h
  9. * encoding: UTF-8
  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. #ifndef __DENSERANGES_H__
  19. #define __DENSERANGES_H__
  20. #include "unicode/utypes.h"
  21. /**
  22. * Does it make sense to write 1..capacity ranges?
  23. * Returns 0 if not, otherwise the number of ranges.
  24. * @param values Sorted array of signed-integer values.
  25. * @param length Number of values.
  26. * @param density Minimum average range density, in 256th. (0x100=100%=perfectly dense.)
  27. * Should be 0x80..0x100, must be 1..0x100.
  28. * @param ranges Output ranges array.
  29. * @param capacity Maximum number of ranges.
  30. * @return Minimum number of ranges (at most capacity) that have the desired density,
  31. * or 0 if that density cannot be achieved.
  32. */
  33. U_CAPI int32_t U_EXPORT2
  34. uprv_makeDenseRanges(const int32_t values[], int32_t length,
  35. int32_t density,
  36. int32_t ranges[][2], int32_t capacity);
  37. #endif // __DENSERANGES_H__