|
@@ -278,11 +278,16 @@ class Input {
|
|
|
var ch3 = readByte();
|
|
|
var ch4 = readByte();
|
|
|
#if (php || python)
|
|
|
- // php will overflow integers. Convert them back to signed 32-bit ints.
|
|
|
- var n = bigEndian ? ch4 | (ch3 << 8) | (ch2 << 16) | (ch1 << 24) : ch1 | (ch2 << 8) | (ch3 << 16) | (ch4 << 24);
|
|
|
- if (n & 0x80000000 != 0)
|
|
|
- return ( n | 0x80000000);
|
|
|
- else return n;
|
|
|
+ // php will overflow integers. Convert them back to signed 32-bit ints.
|
|
|
+ var n = bigEndian ? ch4 | (ch3 << 8) | (ch2 << 16) | (ch1 << 24) : ch1 | (ch2 << 8) | (ch3 << 16) | (ch4 << 24);
|
|
|
+ if (n & 0x80000000 != 0)
|
|
|
+ return ( n | 0x80000000);
|
|
|
+ else return n;
|
|
|
+#elseif lua
|
|
|
+ var n = bigEndian ? ch4 | (ch3 << 8) | (ch2 << 16) | (ch1 << 24) : ch1 | (ch2 << 8) | (ch3 << 16) | (ch4 << 24);
|
|
|
+ // lua can't do 32 bit ints, the adjustment for 64 bits must be numeric
|
|
|
+ if (n > 2147483647) n -= untyped 4294967296.;
|
|
|
+ return n ;
|
|
|
#else
|
|
|
return bigEndian ? ch4 | (ch3 << 8) | (ch2 << 16) | (ch1 << 24) : ch1 | (ch2 << 8) | (ch3 << 16) | (ch4 << 24);
|
|
|
#end
|