Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
algorithms.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2019, 2021 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __UTILS_ALGORITHMS_H__
11#define __UTILS_ALGORITHMS_H__
12
13#include <stdbool.h>
14#include <stddef.h>
15
16#include "utils/types.h"
17
18static inline int
19algorithm_sort_int_cmpfunc (const void * a, const void * b)
20{
21 return (*(int *) a - *(int *) b);
22}
23
36HOT PURE NONNULL void *
38 const void * key,
39 const void * base,
40 size_t nmemb,
41 size_t size,
42 GenericCmpFunc cmp_func,
43 bool return_prev,
44 bool include_equal);
45
46#endif
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.
int(* GenericCmpFunc)(const void *a, const void *b)
Generic comparator.
Definition types.h:104
Custom types.