-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefs.hpp
20 lines (17 loc) · 1007 Bytes
/
defs.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#pragma once
#include <cstdint>
/**
* @brief Counts occurrences of a target character in a given range of characters using parallel execution.
*
* This function divides the input range into chunks and utilizes multiple threads to count occurrences of
* the target character in each chunk. The results are combined to obtain the total count.
*
* @param begin Pointer to the beginning of the character sequence.
* @param end Pointer to the end of the character sequence (one past the last element).
* @param target The character to be counted.
* @param singleThreaded Optional. If set to true, forces the function to execute in a single thread.
* Defaults to false.
* @return The total count of occurrences of the target character in the specified range.
*/
uint64_t opt_count_parallel(const char *begin, const char *end, char target, bool singleThreaded) noexcept;
uint64_t opt_count_parallel(const char *begin, const char *end, int target, bool singleThreaded) noexcept;