* @brief Generates values for the first n elements of a range using a generator function. * * @param first Pointer to the start of the range. * @param n Number of elements to generate. * @param size Size of each element in bytes. * @param gen Generator function that produces values. */
| 1269 | } |
| 1270 | |
| 1271 | const char *ptr1 = (const char*)base1; |
| 1272 | const char *ptr2 = (const char*)base2; |
| 1273 | |
| 1274 | /* from the last possible start backwards: the first hit is the answer */ |
| 1275 | for (size_t i = num1 - num2 + 1; i-- > 0; ) { |
| 1276 | size_t j = 0; |
| 1277 | while (j < num2 && comp(ptr1 + (i + j) * size1, ptr2 + j * size2) == 0) { |
| 1278 | ++j; |
| 1279 | } |
| 1280 | if (j == num2) { |
| 1281 | ALGORITHM_LOG("[algorithm_find_end] Info: Subsequence found starting at index %zu.", i); |
| 1282 | return (void *)(ptr1 + i * size1); |
| 1283 | } |
| 1284 | } |
| 1285 |
nothing calls this directly
no outgoing calls
no test coverage detected