Merge pull request #5767 from pchote/isqrt

Add Exts.ISqrt to avoid fp sqrt calculations.
This commit is contained in:
Matthias Mailänder
2014-07-04 15:48:20 +02:00
6 changed files with 93 additions and 7 deletions

View File

@@ -712,7 +712,7 @@ namespace OpenRA
for (var j = -max; j <= max; j++)
for (var i = -max; i <= max; i++)
if (max * max >= i * i + j * j)
ts [(int)Math.Ceiling(Math.Sqrt(i * i + j * j))].Add(new CVec(i, j));
ts [Exts.ISqrt(i * i + j * j, Exts.ISqrtRoundMode.Ceiling)].Add(new CVec(i, j));
// Sort each integer-distance group by the actual distance
foreach (var list in ts)