Refactor to load lua chunks compiled with 8-byte size_t elements.
This commit is contained in:
@@ -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];
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user