Skip to content

Commit

Permalink
workaround a crash in msvc
Browse files Browse the repository at this point in the history
  • Loading branch information
malytomas committed Jan 2, 2024
1 parent 72b8d1d commit 92901fb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sources/startingPositions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,15 @@ namespace unnatural
return 0;
Real score = Real::Infinity();
for (uint32 i = 0; i < n - 1; i++)
{
for (uint32 j = i + 1; j < n; j++)
score = min(score, distance(tiles[positions[i]].position, tiles[positions[j]].position));
{
const Real c = distance(tiles[positions[i]].position, tiles[positions[j]].position);
//score = min(score, c); // this causes a crash when compiled with visual studio 2022 msvc with optimizations
if (c < score)
score = c;
}
}
return score;
}

Expand Down

0 comments on commit 92901fb

Please sign in to comment.