mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-08 07:34:07 +00:00
Use lj_vm_tobit() on targets without FPU.
This commit is contained in:
parent
f089f3954c
commit
89022b4c3e
@ -786,11 +786,19 @@ static LJ_AINLINE void copyTV(lua_State *L, TValue *o1, const TValue *o2)
|
|||||||
|
|
||||||
/* -- Number to integer conversion ---------------------------------------- */
|
/* -- 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)
|
static LJ_AINLINE int32_t lj_num2bit(lua_Number n)
|
||||||
{
|
{
|
||||||
|
#if LJ_ARCH_HASFPU
|
||||||
TValue o;
|
TValue o;
|
||||||
o.n = n + 6755399441055744.0; /* 2^52 + 2^51 */
|
o.n = n + 6755399441055744.0; /* 2^52 + 2^51 */
|
||||||
return (int32_t)o.u32.lo;
|
return (int32_t)o.u32.lo;
|
||||||
|
#else
|
||||||
|
return lj_vm_tobit(n);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LJ_TARGET_X86 && !defined(__SSE2__)
|
#if LJ_TARGET_X86 && !defined(__SSE2__)
|
||||||
|
@ -541,9 +541,7 @@ LJFOLDF(kfold_add_kptr)
|
|||||||
LJFOLD(TOBIT KNUM KNUM)
|
LJFOLD(TOBIT KNUM KNUM)
|
||||||
LJFOLDF(kfold_tobit)
|
LJFOLDF(kfold_tobit)
|
||||||
{
|
{
|
||||||
TValue tv;
|
return INTFOLD(lj_num2bit(knumleft));
|
||||||
tv.n = knumleft + knumright;
|
|
||||||
return INTFOLD((int32_t)tv.u32.lo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LJFOLD(CONV KINT IRCONV_NUM_INT)
|
LJFOLD(CONV KINT IRCONV_NUM_INT)
|
||||||
|
@ -31,6 +31,9 @@ LJ_ASMF double lj_vm_foldarith(double x, double y, int op);
|
|||||||
#if LJ_HASJIT
|
#if LJ_HASJIT
|
||||||
LJ_ASMF double lj_vm_foldfpm(double x, int op);
|
LJ_ASMF double lj_vm_foldfpm(double x, int op);
|
||||||
#endif
|
#endif
|
||||||
|
#if !LJ_ARCH_HASFPU
|
||||||
|
/* Declared in lj_obj.h: LJ_ASMF int32_t lj_vm_tobit(double x); */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Dispatch targets for recording and hooks. */
|
/* Dispatch targets for recording and hooks. */
|
||||||
LJ_ASMF void lj_vm_record(void);
|
LJ_ASMF void lj_vm_record(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user