Compare commits

...
1 Commits
Author SHA1 Message Date
Nicolas Cannasse 8b9b244512 fix overflow on bigint platforms (close #42) 2017-05-06 11:17:58 +02:00
2 changed files with 4 additions and 11 deletions
+2 -9
View File
@@ -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
View File
@@ -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