Use lj_vm_tobit() on targets without FPU.

This commit is contained in:
Mike Pall
2011-04-10 16:57:09 +02:00
parent f089f3954c
commit 89022b4c3e
3 changed files with 12 additions and 3 deletions

View File

@@ -786,11 +786,19 @@ static LJ_AINLINE void copyTV(lua_State *L, TValue *o1, const TValue *o2)
/* -- Number to integer conversion ---------------------------------------- */
#if !LJ_ARCH_HASFPU
LJ_ASMF int32_t lj_vm_tobit(double x);
#endif
static LJ_AINLINE int32_t lj_num2bit(lua_Number n)
{
#if LJ_ARCH_HASFPU
TValue o;
o.n = n + 6755399441055744.0; /* 2^52 + 2^51 */
return (int32_t)o.u32.lo;
#else
return lj_vm_tobit(n);
#endif
}
#if LJ_TARGET_X86 && !defined(__SSE2__)