* @brief Checks if two ranges are equal. * * This function compares two ranges `[base1, base1 + num1 * size1)` and `[base2, base2 + num2 * size2)` * to determine if they contain the same elements in the same order, as determined by the comparison function `comp`. * * @param base1 Pointer to the start of the first array. * @param num1 Number of elements in the first array. * @param size1 Siz
| 1062 | size_t run = 1; |
| 1063 | if (tmp) { |
| 1064 | run = STB_RUN; |
| 1065 | for (size_t i = 0; i < num; i += run) { |
| 1066 | pdq_insertion(a + i * size, (num - i < run) ? num - i : run, size, comp, tmp, 1); |
| 1067 | } |
| 1068 | } |
| 1069 | for (size_t width = run; width < num; width *= 2) { |
| 1070 | for (size_t i = 0; i < num; ) { |
| 1071 | size_t mid = i + ((width < num - i) ? width : num - i); |
| 1072 | size_t end = mid + ((width < num - mid) ? width : num - mid); |
| 1073 | alg_merge_no_buffer(a + i * size, mid - i, end - mid, size, comp); |
| 1074 | i = end; |
| 1075 | } |
| 1076 | } |
| 1077 | } |
| 1078 | if (tmp && tmp != (char *)stk.bytes) { |
| 1079 | free(tmp); |
| 1080 | } |
| 1081 | ALGORITHM_LOG("[algorithm_stable_sort] Stable sort completed."); |
| 1082 | } |
| 1083 | |
| 1084 | |
| 1085 | /** |
| 1086 | * @brief Sorts an array; the sort is STABLE: elements that compare equal keep |
nothing calls this directly
no outgoing calls
no test coverage detected