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 <cstddef>
14
15#include "utils/types.h"
16
17static inline int
18algorithm_sort_int_cmpfunc (const void * a, const void * b)
19{
20 return (*(int *) a - *(int *) b);
21}
22
35HOT NONNULL void *
37 const void * key,
38 const void * base,
39 size_t nmemb,
40 size_t size,
41 GenericCmpFunc cmp_func,
42 bool return_prev,
43 bool include_equal);
44
45#endif
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.
int(* GenericCmpFunc)(const void *a, const void *b)
Generic comparator.
Definition types.h:108
Custom types.