1 /** 2 * @file lv_utils.h 3 * 4 */ 5 6 #ifndef LV_UTILS_H 7 #define LV_UTILS_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 #include <stdint.h> 17 18 /********************* 19 * DEFINES 20 *********************/ 21 22 /********************** 23 * TYPEDEFS 24 **********************/ 25 26 /********************** 27 * GLOBAL PROTOTYPES 28 **********************/ 29 30 /** Searches base[0] to base[n - 1] for an item that matches *key. 31 * 32 * @note The function cmp must return negative if it's first 33 * argument (the search key) is less that it's second (a table entry), 34 * zero if equal, and positive if greater. 35 * 36 * @note Items in the array must be in ascending order. 37 * 38 * @param key Pointer to item being searched for 39 * @param base Pointer to first element to search 40 * @param n Number of elements 41 * @param size Size of each element 42 * @param cmp Pointer to comparison function (see #unicode_list_compare as a comparison function 43 * example) 44 * 45 * @return a pointer to a matching item, or NULL if none exists. 46 */ 47 void * _lv_utils_bsearch(const void * key, const void * base, uint32_t n, uint32_t size, 48 int32_t (*cmp)(const void * pRef, const void * pElement)); 49 50 /********************** 51 * MACROS 52 **********************/ 53 54 #ifdef __cplusplus 55 } /*extern "C"*/ 56 #endif 57 58 #endif 59