PandA-2024.02
examples
function_pointers
bsearch
musl
bsearch.c
Go to the documentation of this file.
1
typedef
unsigned
int
size_t
;
2
#define NULL 0;
3
4
void
*
bsearch
(
const
void
*
key
,
const
void
*
base
,
size_t
nel,
size_t
width,
int
(*cmp)(
const
void
*,
const
void
*))
5
{
6
void
*
try
;
7
int
sign
;
8
while
(nel > 0) {
9
try
= (
char
*)base + width*(nel/2);
10
sign = cmp(key,
try
);
11
if
(!sign)
return
try
;
12
else
if
(nel == 1)
break
;
13
else
if
(sign < 0)
14
nel /= 2;
15
else
{
16
base =
try
;
17
nel -= nel/2;
18
}
19
}
20
return
NULL
;
21
}
base
char base
This version is stamped on May 10, 2016.
Definition:
nussinov.c:24
bsearch
void * bsearch(const void *__key, const void *__base, size_t __nmemb, size_t __size, int(*__compar)(const void *, const void *))
Definition:
bsearch.c:23
key
int key[32]
Definition:
aes.h:67
NULL
#define NULL
Definition:
bsearch.c:2
sign
uint32_t sign
Definition:
Range_Analysis.cpp:134
size_t
unsigned int size_t
Definition:
bsearch.c:19
Generated on Mon Feb 12 2024 13:02:49 for PandA-2024.02 by
1.8.13