So that it is clear that the function is a wrapper for for_each_n.
llvm-svn: 302718
// Split sections into 256 shards and call Fn in parallel.
size_t NumShards = 256;
size_t Step = Sections.size() / NumShards;
- parallelFor(0, NumShards, [&](size_t I) {
+ parallelForEachN(0, NumShards, [&](size_t I) {
forEachClassRange(I * Step, (I + 1) * Step, Fn);
});
forEachClassRange(Step * NumShards, Sections.size(), Fn);
DenseMap<DefinedRegular *, std::string>
getSymbolStrings(ArrayRef<DefinedRegular *> Syms) {
std::vector<std::string> Str(Syms.size());
- parallelFor(0, Syms.size(), [&](size_t I) {
+ parallelForEachN(0, Syms.size(), [&](size_t I) {
raw_string_ostream OS(Str[I]);
writeHeader<ELFT>(OS, Syms[I]->getVA(), Syms[I]->template getSize<ELFT>(),
0);
if (Filler)
fill(Buf, Sections.empty() ? Size : Sections[0]->OutSecOff, Filler);
- parallelFor(0, Sections.size(), [=](size_t I) {
+ parallelForEachN(0, Sections.size(), [=](size_t I) {
InputSection *Sec = Sections[I];
Sec->writeTo<ELFT>(Buf);
std::vector<uint8_t> Hashes(Chunks.size() * HashSize);
// Compute hash values.
- parallelFor(0, Chunks.size(), [&](size_t I) {
+ parallelForEachN(0, Chunks.size(), [&](size_t I) {
HashFn(Hashes.data() + I * HashSize, Chunks[I]);
});
for_each(parallel::seq, Begin, End, Fn);
}
-inline void parallelFor(size_t Begin, size_t End,
- std::function<void(size_t)> Fn) {
+inline void parallelForEachN(size_t Begin, size_t End,
+ std::function<void(size_t)> Fn) {
if (Config->Threads)
for_each_n(parallel::par, Begin, End, Fn);
else