cosmopolitan/libc/mem/alg.h
Justine Tunney c9152b6f14
Release Cosmopolitan v3.8.0
This change switches c++ exception handling from sjlj to standard dwarf.
It's needed because clang for aarch64 doesn't support sjlj. It turns out
that libunwind had a bare-metal configuration that made this easy to do.

This change gets the new experimental cosmocc -mclang flag in a state of
working so well that it can now be used to build all of llamafile and it
goes 3x faster in terms of build latency, without trading away any perf.

The int_fast16_t and int_fast32_t types are now always defined as 32-bit
in the interest of having more abi consistency between cosmocc -mgcc and
-mclang mode.
2024-08-30 20:14:07 -07:00

35 lines
1.5 KiB
C

#ifndef COSMOPOLITAN_LIBC_ALG_ALG_H_
#define COSMOPOLITAN_LIBC_ALG_ALG_H_
COSMOPOLITAN_C_START_
void *bsearch(const void *, const void *, size_t, size_t,
int (*)(const void *, const void *)) paramsnonnull() nosideeffect;
void *bsearch_r(const void *, const void *, size_t, size_t,
int (*)(const void *, const void *, void *), void *)
paramsnonnull((1, 2, 5)) nosideeffect;
void qsort3(void *, size_t, size_t, int (*)(const void *, const void *))
paramsnonnull();
void qsort(void *, size_t, size_t, int (*)(const void *, const void *))
paramsnonnull();
void qsort_r(void *, size_t, size_t,
int (*)(const void *, const void *, void *), void *)
paramsnonnull((1, 4));
void smoothsort(void *, size_t, size_t, int (*)(const void *, const void *));
void smoothsort_r(void *, size_t, size_t,
int (*)(const void *, const void *, void *), void *);
int heapsort(void *, size_t, size_t, int (*)(const void *, const void *));
int heapsort_r(void *, size_t, size_t,
int (*)(const void *, const void *, void *), void *);
int mergesort(void *, size_t, size_t, int (*)(const void *, const void *));
int mergesort_r(void *, size_t, size_t,
int (*)(const void *, const void *, void *), void *);
#ifdef _COSMO_SOURCE
void djbsort(int32_t *, size_t) libcesque;
int radix_sort_int32(int32_t *, size_t) libcesque;
int radix_sort_int64(int64_t *, size_t) libcesque;
double levenshtein(const char *, const char *) libcesque;
#endif
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_ALG_ALG_H_ */