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

Function algorithm_accumulate

algorithm/algorithm.c:635–648  ·  view source on GitHub ↗

* @brief Accumulates a result by applying an operation sequentially to the elements in a range. * * This function applies the operation `op` to the initial value `init` and each element in the range * `[base, base + num * size)` to accumulate a result. The result is stored in `init`. * * @param base Pointer to the start of the array. * @param num Number of elements in the array. * @param si

Source from the content-addressed store, hash-verified

633 size_t pos = pdq_partition_right(a, n, sz, comp, tmp, &done);
634 size_t ln = pos, rn = n - pos - 1;
635
636 if (ln < n / 8 || rn < n / 8) {
637 if (--bad == 0) {
638 pdq_heapsort(a, n, sz, comp, tmp);
639 return;
640 }
641 if (ln >= PDQ_INSERTION_MAX) {
642 size_t q = ln / 4;
643 pdq_swap_idx(a, 0, q, sz);
644 pdq_swap_idx(a, pos - 1, pos - q, sz);
645 if (ln > PDQ_NINTHER_MIN) {
646 pdq_swap_idx(a, 1, q + 1, sz);
647 pdq_swap_idx(a, 2, q + 2, sz);
648 pdq_swap_idx(a, pos - 2, pos - (q + 1), sz);
649 pdq_swap_idx(a, pos - 3, pos - (q + 2), sz);
650 }
651 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected