diff --git a/src/core/org/luaj/vm2/LoadState.java b/src/core/org/luaj/vm2/LoadState.java index 20410631..f753394a 100644 --- a/src/core/org/luaj/vm2/LoadState.java +++ b/src/core/org/luaj/vm2/LoadState.java @@ -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]; diff --git a/src/core/org/luaj/vm2/lib/MathLib.java b/src/core/org/luaj/vm2/lib/MathLib.java index dfaa02c4..48aa44b2 100644 --- a/src/core/org/luaj/vm2/lib/MathLib.java +++ b/src/core/org/luaj/vm2/lib/MathLib.java @@ -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 { diff --git a/test/lua/luaj3.0-tests.zip b/test/lua/luaj3.0-tests.zip index ba84bbf6..61dd82b5 100644 Binary files a/test/lua/luaj3.0-tests.zip and b/test/lua/luaj3.0-tests.zip differ diff --git a/test/lua/mathlib.lua b/test/lua/mathlib.lua index a3203041..b23f8ffe 100644 --- a/test/lua/mathlib.lua +++ b/test/lua/mathlib.lua @@ -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 }, } diff --git a/test/lua/repack.sh b/test/lua/repack.sh index 75aff3d0..ffece46c 100644 --- a/test/lua/repack.sh +++ b/test/lua/repack.sh @@ -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