Răsfoiți Sursa

make sure Int64 0 is stringified as "0" (fixed issue #903)

Simon Krajewski 13 ani în urmă
părinte
comite
7a0c0a3fd5
2 a modificat fișierele cu 4 adăugiri și 0 ștergeri
  1. 2 0
      std/haxe/Int64.hx
  2. 2 0
      tests/unit/TestInt64.hx

+ 2 - 0
std/haxe/Int64.hx

@@ -36,6 +36,8 @@ class Int64 {
 	}
 
 	function toString() {
+		if (high.isZero() && low.isZero())
+			return "0";
 		var str = "";
 		var neg = false;
 		var i = this;

+ 2 - 0
tests/unit/TestInt64.hx

@@ -23,6 +23,8 @@ class TestInt64 extends Test {
 		eq( Std.string(p40), "1099511627776" );
 		
 		eq( 1.ofInt().shl(0).toStr(), "1" );
+		
+		eq(Int64.ofInt(0).toStr(), "0");
 	}
 
 }