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

Function algorithm_copy

algorithm/algorithm.c:606–618  ·  view source on GitHub ↗

* @brief Copies elements from a source array to a destination array. * * @param source Pointer to the source array. * @param num Number of elements to copy. * @param size Size of each element in bytes. * @param dest Pointer to the destination array. */

Source from the content-addressed store, hash-verified

604ALG_INLINE void pdq_loop_impl(char *a, size_t n, size_t sz, AlgorithmCompareFunc comp, char *tmp,
605 int bad, int leftmost, PdqLoopFunc self) {
606 for (;;) {
607 if (n < PDQ_INSERTION_MAX) {
608 pdq_insertion(a, n, sz, comp, tmp, leftmost);
609 return;
610 }
611 size_t h = n / 2;
612 if (n > PDQ_NINTHER_MIN) {
613 pdq_sort3(a, a + h * sz, a + (n - 1) * sz, sz, comp);
614 pdq_sort3(a + sz, a + (h - 1) * sz, a + (n - 2) * sz, sz, comp);
615 pdq_sort3(a + 2 * sz, a + (h + 1) * sz, a + (n - 3) * sz, sz, comp);
616 pdq_sort3(a + (h - 1) * sz, a + h * sz, a + (h + 1) * sz, sz, comp);
617 alg_swap_bytes(a, a + h * sz, sz);
618 }
619 else {
620 pdq_sort3(a + h * sz, a, a + (n - 1) * sz, sz, comp);
621 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected