CI130X SDK API手册
2.2.0
本手册用于描述CI130X SDK各个组件和驱动API
概述
API参考
utils
dichotomy_find.h
浏览该文件的文档.
1
#ifndef __DICHOTOMY_FIND_H__
2
#define __DICHOTOMY_FIND_H__
3
4
5
6
#ifdef __cplusplus
7
extern
"C"
{
8
#endif
9
10
11
//二分法查找的回调函数类型
12
//pValue: 指向要查找的值的指针
13
//index: 指定用于比较的项的索引号
14
//CallbackPara: 回调参数,可选,用于传递参数给回调函数,可以用于把数组传递给回调函数
15
typedef
int (*
COMPARE_CALLBACK
)(
void
*pValue,
int
index,
void
*CallbackPara);
16
17
18
//二分法查找
19
//pValue: 指向要查找的值的指针
20
//MinIndex: 查找范围的下限
21
//MaxIndex: 查找范围的上限
22
//CompareFunc: 回调函数,用于比较查找值与指定索引的值
23
//CallbackPara: 回调参数,可选,用于传递参数给回调函数,可以用于把数组传递给回调函数
24
//返回值: 大于等于0,返回的是查找到的索引号。小于0,查找失败,未找到。
25
int
dichotomy_find
(
void
*pValue,
int
MinIndex,
int
MaxIndex,
COMPARE_CALLBACK
CompareFunc,
void
*CallbackPara);
26
27
28
29
#ifdef __cplusplus
30
}
31
#endif
32
33
#endif
34
COMPARE_CALLBACK
int(* COMPARE_CALLBACK)(void *pValue, int index, void *CallbackPara)
Definition:
dichotomy_find.h:15
dichotomy_find
int dichotomy_find(void *pValue, int MinIndex, int MaxIndex, COMPARE_CALLBACK CompareFunc, void *CallbackPara)
Definition:
dichotomy_find.c:3
制作者
1.8.14