Browse Source

[cs] remove untyped code from Math, inline isNaN and isFinite

Dan Korostelev 11 years ago
parent
commit
ffd98af7ea
1 changed files with 7 additions and 8 deletions
  1. 7 8
      std/cs/_std/Math.hx

+ 7 - 8
std/cs/_std/Math.hx

@@ -27,11 +27,10 @@ import cs.system.Random;
 	public static inline function __init__():Void
 	{
 		PI = cs.system.Math.PI;
-		NaN = untyped __cs__("double.NaN");
-		NEGATIVE_INFINITY = untyped __cs__("double.NegativeInfinity");
-		POSITIVE_INFINITY = untyped __cs__("double.PositiveInfinity");
+		NaN = cs.system.Double.NaN;
+		NEGATIVE_INFINITY = cs.system.Double.NegativeInfinity;
+		POSITIVE_INFINITY = cs.system.Double.PositiveInfinity;
 		rand = new Random();
-
 	}
 
 	private static var rand:Random;
@@ -153,13 +152,13 @@ import cs.system.Random;
 		return rand.NextDouble();
 	}
 
-	public static function isFinite( f : Float ) : Bool
+	public static inline function isFinite( f : Float ) : Bool
 	{
-		return untyped __cs__("!double.IsInfinity(f) && !double.IsNaN(f)");
+		return !cs.system.Double.IsInfinity(f) && !cs.system.Double.IsNaN(f);
 	}
 
-	public static function isNaN( f : Float ) : Bool
+	public static inline function isNaN( f : Float ) : Bool
 	{
-		return untyped __cs__("double.IsNaN(f)");
+		return cs.system.Double.IsNaN(f);
 	}
 }