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

Generated on Mon Feb 12 2024 13:02:49 for PandA-2024.02 by doxygen 1.8.13