Refactor to load lua chunks compiled with 8-byte size_t elements.

This commit is contained in:
James Roseborough
2012-09-11 04:35:30 +00:00
parent 382b3b998e
commit 84fec1ae67
5 changed files with 5 additions and 8 deletions

View File

@@ -203,7 +203,7 @@ public class LoadState {
* @return the {@link LuaString} value laoded.
**/
LuaString loadString() throws IOException {
int size = loadInt();
int size = this.luacSizeofSizeT == 8? (int) loadInt64(): loadInt();
if ( size == 0 )
return null;
byte[] bytes = new byte[size];

View File

@@ -155,9 +155,8 @@ public class MathLib extends OneArgFunction {
}
static final class ldexp extends BinaryOp {
protected double call(double x, double y) {
y += 1023.5;
long e = (long) ((0!=(1&((int)y)))? Math.floor(y): Math.ceil(y-1));
return x * Double.longBitsToDouble(e << 52);
// This is the behavior on os-x, windows differs in rounding behavior.
return x * Double.longBitsToDouble((((long) y) + 1023) << 52);
}
}
static final class pow extends BinaryOp {

Binary file not shown.

View File

@@ -18,10 +18,8 @@ local UNOPVALUES = { -2.5, -2, 0, 2, 2.5, "'-2.5'", "'-2'", "'0'", "'2'", "'2.5'
local NUMBERPAIRS = {
{ 2, 0 }, { -2.5, 0 }, { 2, 1 },
{ 5, 2 }, {-5, 2 }, {16, 2}, {-16, -2},
{256, .5}, {256, .25}, {256, 0.625},
{256, -0.5}, {256, -.25}, {256, -.625}, {-256, .5},
{ .5, 0}, {.5, 1}, {.5, 2}, {.5, -1}, {.5, 2},
{2.25, 0}, {2.25, 2}, {2.25, .5}, {2.25, 2.5}, {-2, 0},
{2.25, 0}, {2.25, 2}, {-2, 0},
{ 3, 3 },
}

View File

@@ -32,7 +32,7 @@ cd lua
# create new zipfile
rm -f luaj3.0-tests.zip regressions
zip -9 luaj3.0-tests.zip *.lua *.lc *.out */*.lua */*.lc */*.out
zip luaj3.0-tests.zip *.lua *.lc *.out */*.lua */*.lc */*.out
# cleanup
rm *.out */*.lc */*.out