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

Various algorithms. More...

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

Go to the source code of this file.

Functions

HOT 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 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).