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

Function algorithm_rotate

algorithm/algorithm.c:1642–1660  ·  view source on GitHub ↗

* @brief Rotates elements in a range. * * @param first Pointer to the start of the range. * @param middle Pointer to the middle of the range. * @param last Pointer to the end of the range. * @param size Size of each element in bytes. */

Source from the content-addressed store, hash-verified

1640
1641 if (!first || !last || !val || size == 0 || (char *)last <= (char *)first) {
1642 return;
1643 }
1644 /* whole elements only: a range that is not a multiple of size used to
1645 run past `last` */
1646 alg_fill_range((char *)first, (size_t)((char *)last - (char *)first) / size, size, val);
1647
1648 ALGORITHM_LOG("[algorithm_fill] Success: Range filled with value.");
1649}
1650
1651/**
1652 * @brief Fills the first n elements of a range with a specified value.
1653 *
1654 * @param first Pointer to the start of the range.
1655 * @param n Number of elements to fill.
1656 * @param size Size of each element in bytes.
1657 * @param val Pointer to the value to fill the range with.
1658 */
1659void algorithm_fill_n(void *first, size_t n, size_t size, const void *val) {
1660 ALGORITHM_LOG("[algorithm_fill_n] Info: Filling first %zu elements with value.", n);
1661
1662 if (!first || !val || size == 0) {
1663 return;

Callers

nothing calls this directly

Calls 1

swapFunction · 0.85

Tested by

no test coverage detected