Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ToInt32() [6/19]

static int System.Convert.ToInt32 ( double value)
inlinestatic

Definition at line 1413 of file Convert.cs.

1414 {
1415 if (value >= 0.0)
1416 {
1417 if (value < 2147483647.5)
1418 {
1419 int num = (int)value;
1420 double num2 = value - (double)num;
1421 if (num2 > 0.5 || (num2 == 0.5 && ((uint)num & (true ? 1u : 0u)) != 0))
1422 {
1423 num++;
1424 }
1425 return num;
1426 }
1427 }
1428 else if (value >= -2147483648.5)
1429 {
1430 int num3 = (int)value;
1431 double num4 = value - (double)num3;
1432 if (num4 < -0.5 || (num4 == -0.5 && ((uint)num3 & (true ? 1u : 0u)) != 0))
1433 {
1434 num3--;
1435 }
1436 return num3;
1437 }
1438 throw new OverflowException(SR.Overflow_Int32);
1439 }

References System.SR.Overflow_Int32, and System.value.