Skip to content

Commit

Permalink
Bench: 24311257
Browse files Browse the repository at this point in the history
  • Loading branch information
TerjeKir committed Dec 31, 2024
1 parent 179c96b commit 85b62ed
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,16 @@ void InitThreads(int count) {

// Sorts all rootmoves beginning from the given index
void SortRootMoves(Thread *thread, int begin) {
RootMove *rootMoves = thread->rootMoves;

for (int i = begin + 1; i < thread->rootMoveCount; ++i) {
RootMove temp = thread->rootMoves[i];
RootMove temp = rootMoves[i];
int j = i - 1;
while (j >= 0 && thread->rootMoves[j].score < temp.score)
thread->rootMoves[j+1] = thread->rootMoves[j], --j;
thread->rootMoves[j+1] = temp;
while (j >= 0 && rootMoves[j].score < temp.score) {
rootMoves[j+1] = rootMoves[j];
--j;
}
rootMoves[j+1] = temp;
}
}

Expand Down

0 comments on commit 85b62ed

Please sign in to comment.