MCPcopy Create free account
hub / github.com/KaisenAmin/c_std / algorithm_any_of

Function algorithm_any_of

algorithm/algorithm.c:693–706  ·  view source on GitHub ↗

* @brief Checks if any element in a range satisfies a predicate. * * This function returns `true` if the predicate `pred` returns `true` for any element in the range * `[base, base + num * size)`. Otherwise, it returns `false`. * * @param base Pointer to the start of the array. * @param num Number of elements in the array. * @param size Size of each element in bytes. * @param pred Predicat

Source from the content-addressed store, hash-verified

691static void pdq_loop_any(char *a, size_t n, size_t sz, AlgorithmCompareFunc comp, char *tmp, int bad, int leftmost) {
692 pdq_loop_impl(a, n, sz, comp, tmp, bad, leftmost, pdq_loop_any);
693}
694
695
696/* ================================================================== */
697/* Stable sort: bottom-up merge sort */
698/* ================================================================== */
699/*
700 * Runs of STB_RUN elements are insertion-sorted in place, then merged pairwise
701 * level by level, alternating between the array and a buffer of the same
702 * size (no copy-back per merge). Two runs that are already in order (last of
703 * the left <= first of the right) are copied instead of merged, so sorted
704 * input costs O(n). The merge picks the next element without a branch on the
705 * comparison. Without memory for the buffer, the runs are merged in place
706 * with rotations instead (O(n log^2 n), still stable).
707 */
708#define STB_RUN 16
709#ifndef STB_BLOCK_BYTES

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected