瀏覽代碼

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

Nicolas Cannasse 12 年之前
父節點
當前提交
93b3c0788d
共有 1 個文件被更改,包括 2 次插入3 次删除
  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,"");
 		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 {
 	public static function parseInt( x : String ) : Null<Int> untyped {