* @brief Swaps ranges of elements between two arrays. * * @param first1 Pointer to the start of the first array. * @param first2 Pointer to the start of the second array. * @param num Number of elements to swap. * @param size Size of each element in bytes. */
| 1544 | * @param size Size of each element in bytes. |
| 1545 | */ |
| 1546 | void algorithm_swap_ranges(void *first1, void *first2, size_t num, size_t size) { |
| 1547 | ALGORITHM_LOG("[algorithm_swap_ranges] Info: Swapping %zu elements between two arrays of element size %zu.", num, size); |
| 1548 | |
| 1549 | char *ptr1 = (char *)first1; |
| 1550 | char *ptr2 = (char *)first2; |
| 1551 | |
| 1552 | for (size_t i = 0; i < num; ++i) { |
| 1553 | algorithm_swap(ptr1 + i * size, ptr2 + i * size, size); |
| 1554 | ALGORITHM_LOG("[algorithm_swap_ranges] Info: Swapped element %zu.", i); |
| 1555 | } |
| 1556 | |
| 1557 | ALGORITHM_LOG("[algorithm_swap_ranges] Success: Swap ranges completed."); |
| 1558 | } |
| 1559 | |
| 1560 | |
| 1561 | /** |
nothing calls this directly
no test coverage detected