fix overflow on bigint platforms (close #42)
This commit is contained in:
@@ -21,15 +21,8 @@ class Test extends TestCase {
|
||||
function test():Void {
|
||||
assertScript("0",0);
|
||||
assertScript("0xFF", 255);
|
||||
#if !(php || python)
|
||||
#if haxe3
|
||||
assertScript("0xBFFFFFFF", 0xBFFFFFFF);
|
||||
assertScript("0x7FFFFFFF", 0x7FFFFFFF);
|
||||
#elseif !neko
|
||||
assertScript("n(0xBFFFFFFF)", 0xBFFFFFFF, { n : haxe.Int32.toNativeInt });
|
||||
assertScript("n(0x7FFFFFFF)", 0x7FFFFFFF, { n : haxe.Int32.toNativeInt } );
|
||||
#end
|
||||
#end
|
||||
assertScript("0xBFFFFFFF", 0xBFFFFFFF);
|
||||
assertScript("0x7FFFFFFF", 0x7FFFFFFF);
|
||||
assertScript("-123",-123);
|
||||
assertScript("- 123",-123);
|
||||
assertScript("1.546",1.546);
|
||||
|
||||
+2
-2
@@ -983,7 +983,7 @@ class Parser {
|
||||
// in case of '...'
|
||||
if( exp == 10 && readChar() == 46 ) {
|
||||
push(TOp("..."));
|
||||
var i = Std.int(n);
|
||||
var i = Std.int(n) & 0xFFFFFFFF;
|
||||
return TConst( (i == n) ? CInt(i) : CFloat(n) );
|
||||
}
|
||||
invalidChar(char);
|
||||
@@ -1006,7 +1006,7 @@ class Parser {
|
||||
n = (n << 4) + (char - 87);
|
||||
default:
|
||||
this.char = char;
|
||||
return TConst(CInt(n));
|
||||
return TConst(CInt(n & 0xFFFFFFFF));
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user