Add a helper for multiplying by sqrt(2)

This commit is contained in:
RoosterDragon
2021-11-14 09:31:34 +00:00
committed by abcdefg30
parent f0e24f6d21
commit a59f4b2c4a
3 changed files with 12 additions and 7 deletions

View File

@@ -357,6 +357,11 @@ namespace OpenRA
return root;
}
public static int MultiplyBySqrtTwo(short number)
{
return number * 46341 / 32768;
}
public static int IntegerDivisionRoundingAwayFromZero(int dividend, int divisor)
{
var quotient = Math.DivRem(dividend, divisor, out var remainder);