Skip to content

Commit aa2e1f5

Browse files
committed
Updated for Factorio version 1.1.85.
1 parent a402810 commit aa2e1f5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/llimits.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,14 @@ typedef lu_int32 Instruction;
238238
(((u) <= (lua_Unsigned)INT_MAX) ? (lua_Number)(int)(u) : (lua_Number)(u))
239239
#endif
240240

241-
241+
#ifdef NINTENDO_SWITCH
242+
//workaround for the undefined behaviors causing problems with the implementation below.
243+
//This is taken from MS_ASMTRICK part of this original file
244+
union luai_Cast { double l_d; LUA_INT32 l_p[2]; };
245+
#define luai_hashnum(i,n) \
246+
{ volatile union luai_Cast u; u.l_d = (n) + 1.0; /* avoid -0 */ \
247+
(i) = u.l_p[0]; (i) += u.l_p[1]; } /* add double bits for his hash */
248+
#endif
242249

243250
#if defined(ltable_c) && !defined(luai_hashnum)
244251

0 commit comments

Comments
 (0)