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

Function algorithm_transform

algorithm/algorithm.c:962–974  ·  view source on GitHub ↗

* @brief Transforms each element in an array and stores the result in another array. * * @param base Pointer to the start of the input array. * @param num Number of elements in the array. * @param size Size of each element in bytes. * @param result Pointer to the output array where the results will be stored. * @param op Transformation function to apply to each element. */

Source from the content-addressed store, hash-verified

960 /* [cut1, n1) and [n1, n1 + cut2) swap places */
961 alg_rotate_bytes(a + cut1 * sz, (n1 - cut1) * sz, cut2 * sz);
962 size_t mid = cut1 + cut2;
963 /* the smaller half recursively, the larger one in this loop */
964 if (cut1 + cut2 < (n1 - cut1) + (n2 - cut2)) {
965 alg_merge_no_buffer(a, cut1, cut2, sz, comp);
966 a += mid * sz;
967 n1 -= cut1;
968 n2 -= cut2;
969 }
970 else {
971 alg_merge_no_buffer(a + mid * sz, n1 - cut1, n2 - cut2, sz, comp);
972 n1 = cut1;
973 n2 = cut2;
974 }
975 }
976}
977

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected