diff --git a/src/lua/ldump.c b/src/lua/ldump.c index 56bca872..6076d85b 100644 --- a/src/lua/ldump.c +++ b/src/lua/ldump.c @@ -118,6 +118,9 @@ static void DumpSize(int32_t x, DumpState* D) static void DumpNumber(lua_Number x, DumpState* D) { +#if defined( LUA_NUMBER_INTEGRAL ) && !defined( LUA_CROSS_COMPILER ) + DumpIntWithSize(x,D->target.sizeof_lua_Number,D); +#else // #if defined( LUA_NUMBER_INTEGRAL ) && !defined( LUA_CROSS_COMPILER ) if (D->target.lua_Number_integral) { if (((float)(int)x)!=x) D->status=LUA_ERR_CC_NOTINTEGER; @@ -137,7 +140,7 @@ static void DumpNumber(lua_Number x, DumpState* D) double y=x; // ARM FPA mode: keep endianness, but swap high and low parts of the // memory representation. This is the default compilation mode for ARM - // targets (at least with GCC) + // targets with non-EABI gcc if(D->target.is_arm_fpa) { char *pnum=(char*)&y, temp[4]; @@ -151,6 +154,7 @@ static void DumpNumber(lua_Number x, DumpState* D) default: lua_assert(0); } } +#endif // #if defined( LUA_NUMBER_INTEGRAL ) && !defined( LUA_CROSS_COMPILER ) } static void DumpCode(const Proto *f, DumpState* D) diff --git a/src/modules/lpack.c b/src/modules/lpack.c index 4bb3c19a..a9621371 100644 --- a/src/modules/lpack.c +++ b/src/modules/lpack.c @@ -152,8 +152,10 @@ static int l_unpack(lua_State *L) /** unpack(s,f,[init]) */ UNPACKSTRING(OP_WSTRING, unsigned short) UNPACKSTRING(OP_SSTRING, size_t) UNPACKNUMBER(OP_NUMBER, lua_Number) +#ifndef LUA_NUMBER_INTEGRAL UNPACKNUMBER(OP_DOUBLE, double) UNPACKNUMBER(OP_FLOAT, float) +#endif UNPACKNUMBER(OP_CHAR, char) UNPACKNUMBER(OP_BYTE, unsigned char) UNPACKNUMBER(OP_SHORT, short) @@ -234,8 +236,10 @@ static int l_pack(lua_State *L) /** pack(f,...) */ PACKSTRING(OP_WSTRING, unsigned short) PACKSTRING(OP_SSTRING, size_t) PACKNUMBER(OP_NUMBER, lua_Number) +#ifndef LUA_NUMBER_INTEGRAL PACKNUMBER(OP_DOUBLE, double) PACKNUMBER(OP_FLOAT, float) +#endif PACKNUMBER(OP_CHAR, char) PACKNUMBER(OP_BYTE, unsigned char) PACKNUMBER(OP_SHORT, short)