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

Function algorithm_min_element

algorithm/algorithm.c:557–575  ·  view source on GitHub ↗

* @brief Finds the minimum element in a range. * * This function iterates over the elements in the range `[base, base + num * size)` to find the minimum * element, as determined by the comparison function `comp`. * * @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 comp Comparison function use

Source from the content-addressed store, hash-verified

555 }
556 numl -= num;
557 numr -= num;
558 startl += num;
559 startr += num;
560 if (numl == 0) {
561 startl = 0;
562 basel = f;
563 }
564 if (numr == 0) {
565 startr = 0;
566 baser = l;
567 }
568 }
569 if (numl) {
570 while (numl--) {
571 --l;
572 char *x = a + (basel + offl[startl + numl]) * sz;
573 if (x != a + l * sz) {
574 alg_swap_bytes(x, a + l * sz, sz);
575 }
576 }
577 f = l;
578 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected