1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00

fixes to prevent linking of the compiler floating point emulation functions on different targets

This commit is contained in:
Bogdan Marinescu 2010-11-30 23:13:25 +00:00
parent b583073b98
commit fb775c55f5
2 changed files with 9 additions and 1 deletions

View File

@ -118,6 +118,9 @@ static void DumpSize(int32_t x, DumpState* D)
static void DumpNumber(lua_Number 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 (D->target.lua_Number_integral)
{ {
if (((float)(int)x)!=x) D->status=LUA_ERR_CC_NOTINTEGER; 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; double y=x;
// ARM FPA mode: keep endianness, but swap high and low parts of the // ARM FPA mode: keep endianness, but swap high and low parts of the
// memory representation. This is the default compilation mode for ARM // 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) if(D->target.is_arm_fpa)
{ {
char *pnum=(char*)&y, temp[4]; char *pnum=(char*)&y, temp[4];
@ -151,6 +154,7 @@ static void DumpNumber(lua_Number x, DumpState* D)
default: lua_assert(0); default: lua_assert(0);
} }
} }
#endif // #if defined( LUA_NUMBER_INTEGRAL ) && !defined( LUA_CROSS_COMPILER )
} }
static void DumpCode(const Proto *f, DumpState* D) static void DumpCode(const Proto *f, DumpState* D)

View File

@ -152,8 +152,10 @@ static int l_unpack(lua_State *L) /** unpack(s,f,[init]) */
UNPACKSTRING(OP_WSTRING, unsigned short) UNPACKSTRING(OP_WSTRING, unsigned short)
UNPACKSTRING(OP_SSTRING, size_t) UNPACKSTRING(OP_SSTRING, size_t)
UNPACKNUMBER(OP_NUMBER, lua_Number) UNPACKNUMBER(OP_NUMBER, lua_Number)
#ifndef LUA_NUMBER_INTEGRAL
UNPACKNUMBER(OP_DOUBLE, double) UNPACKNUMBER(OP_DOUBLE, double)
UNPACKNUMBER(OP_FLOAT, float) UNPACKNUMBER(OP_FLOAT, float)
#endif
UNPACKNUMBER(OP_CHAR, char) UNPACKNUMBER(OP_CHAR, char)
UNPACKNUMBER(OP_BYTE, unsigned char) UNPACKNUMBER(OP_BYTE, unsigned char)
UNPACKNUMBER(OP_SHORT, short) UNPACKNUMBER(OP_SHORT, short)
@ -234,8 +236,10 @@ static int l_pack(lua_State *L) /** pack(f,...) */
PACKSTRING(OP_WSTRING, unsigned short) PACKSTRING(OP_WSTRING, unsigned short)
PACKSTRING(OP_SSTRING, size_t) PACKSTRING(OP_SSTRING, size_t)
PACKNUMBER(OP_NUMBER, lua_Number) PACKNUMBER(OP_NUMBER, lua_Number)
#ifndef LUA_NUMBER_INTEGRAL
PACKNUMBER(OP_DOUBLE, double) PACKNUMBER(OP_DOUBLE, double)
PACKNUMBER(OP_FLOAT, float) PACKNUMBER(OP_FLOAT, float)
#endif
PACKNUMBER(OP_CHAR, char) PACKNUMBER(OP_CHAR, char)
PACKNUMBER(OP_BYTE, unsigned char) PACKNUMBER(OP_BYTE, unsigned char)
PACKNUMBER(OP_SHORT, short) PACKNUMBER(OP_SHORT, short)