@@ -392,42 +392,37 @@ void Steps::CalcEtternaMetadata() {
392
392
RString Steps::GenerateChartKey (NoteData& nd, TimingData *td) {
393
393
RString o = " X" ; // I was thinking of using "C" to indicate chart.. however.. X is cooler... - Mina
394
394
vector<int >& nerv = nd.GetNonEmptyRowVector ();
395
-
396
- for (int i = 0 ; i < 8 ; ++i) {
397
- unsigned int numThreads = max (std::thread::hardware_concurrency (), 1u ) - i;
398
- std::vector<RString> keyParts;
399
- keyParts.reserve (numThreads);
400
395
401
- size_t segmentSize = nerv. size () / numThreads ;
402
- std::vector<std::thread> threads ;
403
- threads .reserve (numThreads);
396
+ unsigned int numThreads = max ( std::thread::hardware_concurrency (), 1u ) ;
397
+ std::vector<RString> keyParts ;
398
+ keyParts .reserve (numThreads);
404
399
405
- for (unsigned int curThread = 0 ; curThread < numThreads; curThread++)
406
- {
407
- keyParts.push_back (" " );
408
- size_t start = segmentSize * curThread;
409
- size_t end = start + segmentSize;
410
- if (curThread + 1 == numThreads)
411
- end = nerv.size ();
400
+ size_t segmentSize = nerv.size () / numThreads;
401
+ std::vector<std::thread> threads;
402
+ threads.reserve (numThreads);
412
403
413
- threads.push_back (std::thread (&Steps::FillStringWithBPMs, this , start, end, std::ref (nerv), std::ref (nd), td, std::ref (keyParts[curThread])));
414
- }
404
+ for (unsigned int curThread = 0 ; curThread < numThreads; curThread++)
405
+ {
406
+ keyParts.push_back (" " );
407
+ size_t start = segmentSize * curThread;
408
+ size_t end = start + segmentSize;
409
+ if (curThread + 1 == numThreads)
410
+ end = nerv.size ();
415
411
416
- for (auto & t : threads)
417
- {
418
- if (t.joinable ())
419
- t.join ();
420
- }
412
+ threads.push_back (std::thread (&Steps::FillStringWithBPMs, this , start, end, std::ref (nerv), std::ref (nd), td, std::ref (keyParts[curThread])));
413
+ }
421
414
422
- // handle empty charts if they get to here -mina
423
- if (*keyParts.data () == " " )
424
- return " " ;
415
+ for (auto & t : threads)
416
+ {
417
+ if (t.joinable ())
418
+ t.join ();
419
+ }
425
420
426
- LOG->Trace (" Threads Used: %i, *keyparts.data() = %s" , numThreads, *keyParts.data ());
421
+ // handle empty charts if they get to here -mina
422
+ if (*keyParts.data () == " " )
423
+ return " " ;
427
424
428
- if (i == 0 )
429
- o.append (BinaryToHex (CryptManager::GetSHA1ForString (*keyParts.data ())));
430
- }
425
+ o.append (BinaryToHex (CryptManager::GetSHA1ForString (*keyParts.data ())));
431
426
432
427
return o;
433
428
}
0 commit comments