lv_utils.h

Functions

void *_lv_utils_bsearch(const void *key, const void *base, uint32_t n, uint32_t size, int32_t (*cmp)(const void *pRef, const void *pElement))

Searches base[0] to base[n - 1] for an item that matches *key.

Note

The function cmp must return negative if it's first argument (the search key) is less that it's second (a table entry), zero if equal, and positive if greater.

Note

Items in the array must be in ascending order.

Parameters:
  • key -- Pointer to item being searched for

  • base -- Pointer to first element to search

  • n -- Number of elements

  • size -- Size of each element

  • cmp -- Pointer to comparison function (see #unicode_list_compare as a comparison function example)

Returns:

a pointer to a matching item, or NULL if none exists.