Turnstone Operating System
Loading...
Searching...
No Matches
binarysearch.h File Reference

binarysearch interface More...

#include <types.h>

Macros

#define ___BINARYSEARCH_H   0
 

Typedefs

typedef int8_t(* binarysearch_comparator_f) (const void *item1, const void *item2)
 item comparator More...
 

Functions

void * binarysearch (void *list, uint64_t size, uint64_t item_size, void *key, binarysearch_comparator_f cmp)
 binarsearch More...
 

Detailed Description

binarysearch interface

This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.

Macro Definition Documentation

◆ ___BINARYSEARCH_H

#define ___BINARYSEARCH_H   0

macro for avoiding multiple inclusion

Typedef Documentation

◆ binarysearch_comparator_f

typedef int8_t(* binarysearch_comparator_f) (const void *item1, const void *item2)

item comparator

Parameters
[in]item1first item
[in]item2second item
Returns
-1 if item1<item2, 1 if item1>item2, 0 otherwise

Function Documentation

◆ binarysearch()

void * binarysearch ( void *  list,
uint64_t  size,
uint64_t  item_size,
void *  key,
binarysearch_comparator_f  cmp 
)

binarsearch

Parameters
[in]listlist to search
[in]sizelist size
[in]item_sizeeach item size in list
[in]keyto search
[in]cmpbinarsearch comparator binarysearch_comparator_f
Returns
found item or null