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

Function algorithm_find_if

algorithm/algorithm.c:321–334  ·  view source on GitHub ↗

* @brief Finds the first element in a range that satisfies a predicate. * * This function searches for the first element in the range `[base, base + num * size)` that satisfies * the predicate function `pred`. * * @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 Predicate function that re

Source from the content-addressed store, hash-verified

319 }
320 return kept;
321}
322
323static size_t alg_filter_dispatch(const char *src, size_t num, size_t sz, char *dst,
324 BoolPredicateFunc pred, ContextPredicateFunc cpred, void *ctx, int negate) {
325 if (pred && negate) {
326 switch (sz) {
327 case 4: return alg_filter_loop(src, num, 4, dst, 3, pred, NULL, NULL);
328 case 8: return alg_filter_loop(src, num, 8, dst, 3, pred, NULL, NULL);
329 default: return alg_filter_loop(src, num, sz, dst, 3, pred, NULL, NULL);
330 }
331 }
332 if (pred) {
333 switch (sz) {
334 case 4: return alg_filter_loop(src, num, 4, dst, 0, pred, NULL, NULL);
335 case 8: return alg_filter_loop(src, num, 8, dst, 0, pred, NULL, NULL);
336 default: return alg_filter_loop(src, num, sz, dst, 0, pred, NULL, NULL);
337 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected