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

Function algorithm_generate

algorithm/algorithm.c:1249–1260  ·  view source on GitHub ↗

* @brief Generates values for a range using a generator function. * * @param first Pointer to the start of the range. * @param last Pointer to the end of the range. * @param size Size of each element in bytes. * @param gen Generator function that produces values. */

Source from the content-addressed store, hash-verified

1247 *
1248 * @param base1 Pointer to the start of the main array.
1249 * @param num1 Number of elements in the main array.
1250 * @param size1 Size of each element in the main array in bytes.
1251 * @param base2 Pointer to the start of the subsequence array.
1252 * @param num2 Number of elements in the subsequence array.
1253 * @param size2 Size of each element in the subsequence array in bytes.
1254 * @param comp Comparison function used to compare elements.
1255 * It should return 0 if the elements are equal, and a non-zero value otherwise.
1256 *
1257 * @return Pointer to the start of the last occurrence of the subsequence, or `NULL` if not found.
1258 */
1259void *algorithm_find_end(const void *base1, size_t num1, size_t size1, const void *base2, size_t num2, size_t size2, CompareFunc comp) {
1260 ALGORITHM_LOG("[algorithm_find_end] Info: Searching for the last occurrence of the subsequence in the main array.");
1261
1262 if (num2 == 0) {
1263 ALGORITHM_LOG("[algorithm_find_end] Info: Subsequence is empty, returning pointer to the end of the main array.");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected