perhaps this works better

This commit is contained in:
Lily Brown 2023-10-27 13:42:42 -07:00
parent 9216e4cb27
commit 98217437ec
2 changed files with 3 additions and 3 deletions

View File

@ -1374,7 +1374,8 @@ static int luauF_writeinteger(lua_State* L, StkId res, TValue* arg0, int nresult
return -1; return -1;
unsigned value; unsigned value;
luai_num2unsigned(value, nvalue(args + 1)); double incoming = nvalue(args + 1);
luai_num2unsigned(value, incoming);
T val = T(value); T val = T(value);
memcpy((char*)bufvalue(arg0)->data + offset, &val, sizeof(T)); memcpy((char*)bufvalue(arg0)->data + offset, &val, sizeof(T));

View File

@ -53,9 +53,8 @@ LUAU_FASTMATH_END
#if defined(_MSC_VER) && defined(_M_IX86) #if defined(_MSC_VER) && defined(_M_IX86)
#define luai_num2unsigned(i, n) \ #define luai_num2unsigned(i, n) \
{ \ { \
double v = (n); \
__int64 l; \ __int64 l; \
__asm { __asm fld v __asm fistp l} \ __asm { __asm fld n __asm fistp l} \
; \ ; \
i = (unsigned int)l; \ i = (unsigned int)l; \
} }