Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
algorithms.h File Reference

Various algorithms. More...

#include <stdbool.h>
#include <stddef.h>
#include "utils/types.h"
Include dependency graph for algorithms.h:

Go to the source code of this file.

Functions

HOT PURE NONNULL void * algorithms_binary_search_nearby (const void *key, const void *base, size_t nmemb, size_t size, GenericCmpFunc cmp_func, bool return_prev, bool include_equal)
 Binary search with the option to find the closest member in a sorted array.
 

Detailed Description

Various algorithms.

Definition in file algorithms.h.

Function Documentation

◆ algorithms_binary_search_nearby()

HOT PURE NONNULL void * algorithms_binary_search_nearby ( const void * key,
const void * base,
size_t nmemb,
size_t size,
GenericCmpFunc cmp_func,
bool return_prev,
bool include_equal )

Binary search with the option to find the closest member in a sorted array.

All of the parameters except the following are the same as the C std bsearch().

Parameters
return_prevTrue to return previous closest element, false for next.
include_equalInclude equal elements (if an exact match is found, return it).