Browse Source

fixed Std.int should overflow on 32 bits (cross platform behavior)

Nicolas Cannasse 12 năm trước cách đây
mục cha
commit
93b3c0788d
1 tập tin đã thay đổi với 2 bổ sung3 xóa
  1. 2 3
      std/flash8/_std/Std.hx

+ 2 - 3
std/flash8/_std/Std.hx

@@ -30,9 +30,8 @@
 		return untyped flash.Boot.__string_rec(s,"");
 	}
 
-	public static function int( x : Float ) : Int {
-		if( x < 0 ) return Math.ceil(x);
-		return Math.floor(x);
+	public static inline function int( x : Float ) : Int {
+		return (cast x) | 0;
 	}
 
 	public static function parseInt( x : String ) : Null<Int> untyped {