29 #define MAX_SIZET ((size_t)(~(size_t)0)-2)
31 #define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2)
33 #define MAX_LMEM ((l_mem) ((MAX_LUMEM >> 1) - 2))
36 #define MAX_INT (INT_MAX-2)
43 #define IntPoint(p) ((unsigned int)(lu_mem)(p))
48 #if !defined(LUAI_USER_ALIGNMENT_T)
49 #define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; }
60 #if defined(lua_assert)
61 #define check_exp(c,e) (lua_assert(c), (e))
63 #define lua_longassert(c) { if (!(c)) lua_assert(0); }
65 #define lua_assert(c) ((void)0)
66 #define check_exp(c,e) (e)
67 #define lua_longassert(c) ((void)0)
73 #if !defined(luai_apicheck)
75 #if defined(LUA_USE_APICHECK)
77 #define luai_apicheck(L,e) assert(e)
79 #define luai_apicheck(L,e) lua_assert(e)
84 #define api_check(l,e,msg) luai_apicheck(l,(e) && msg)
88 #define UNUSED(x) ((void)(x))
92 #define cast(t, exp) ((t)(exp))
94 #define cast_byte(i) cast(lu_byte, (i))
95 #define cast_num(i) cast(lua_Number, (i))
96 #define cast_int(i) cast(int, (i))
97 #define cast_uchar(i) cast(unsigned char, (i))
103 #if defined(__GNUC__)
104 #define l_noret void __attribute__((noreturn))
105 #elif defined(_MSC_VER)
106 #define l_noret void __declspec(noreturn)
117 #if !defined(LUAI_MAXCCALLS)
118 #define LUAI_MAXCCALLS 200
125 #define MAXUPVAL UCHAR_MAX
142 #if !defined(MINSTRTABSIZE)
143 #define MINSTRTABSIZE 32
148 #if !defined(LUA_MINBUFFER)
149 #define LUA_MINBUFFER 32
153 #if !defined(lua_lock)
154 #define lua_lock(L) ((void) 0)
155 #define lua_unlock(L) ((void) 0)
158 #if !defined(luai_threadyield)
159 #define luai_threadyield(L) {lua_unlock(L); lua_lock(L);}
168 #if !defined(luai_userstateopen)
169 #define luai_userstateopen(L) ((void)L)
172 #if !defined(luai_userstateclose)
173 #define luai_userstateclose(L) ((void)L)
176 #if !defined(luai_userstatethread)
177 #define luai_userstatethread(L,L1) ((void)L)
180 #if !defined(luai_userstatefree)
181 #define luai_userstatefree(L,L1) ((void)L)
184 #if !defined(luai_userstateresume)
185 #define luai_userstateresume(L,n) ((void)L)
188 #if !defined(luai_userstateyield)
189 #define luai_userstateyield(L,n) ((void)L)
202 #if defined(MS_ASMTRICK) || defined(LUA_MSASMTRICK)
205 #define lua_number2int(i,n) __asm {__asm fld n __asm fistp i}
206 #define lua_number2integer(i,n) lua_number2int(i, n)
207 #define lua_number2unsigned(i,n) \
208 {__int64 l; __asm {__asm fld n __asm fistp l} i = (unsigned int)l;}
211 #elif defined(LUA_IEEE754TRICK)
217 #if !defined(LUA_IEEEENDIAN)
218 #define LUAI_EXTRAIEEE \
219 static const union luai_Cast ieeeendian = {-(33.0 + 6755399441055744.0)};
220 #define LUA_IEEEENDIANLOC (ieeeendian.l_p[1] == 33)
222 #define LUA_IEEEENDIANLOC LUA_IEEEENDIAN
223 #define LUAI_EXTRAIEEE
226 #define lua_number2int32(i,n,t) \
228 volatile union luai_Cast u; u.l_d = (n) + 6755399441055744.0; \
229 (i) = (t)u.l_p[LUA_IEEEENDIANLOC]; }
231 #define luai_hashnum(i,n) \
232 { volatile union luai_Cast u; u.l_d = (n) + 1.0; \
233 (i) = u.l_p[0]; (i) += u.l_p[1]; }
235 #define lua_number2int(i,n) lua_number2int32(i, n, int)
236 #define lua_number2unsigned(i,n) lua_number2int32(i, n, lua_Unsigned)
239 #if defined(LUA_IEEELL)
240 #define lua_number2integer(i,n) lua_number2int32(i, n, lua_Integer)
248 #if !defined(lua_number2int)
249 #define lua_number2int(i,n) ((i)=(int)(n))
252 #if !defined(lua_number2integer)
253 #define lua_number2integer(i,n) ((i)=(lua_Integer)(n))
256 #if !defined(lua_number2unsigned)
258 #if defined(LUA_NUMBER_DOUBLE) || defined(LUA_NUMBER_FLOAT)
260 #define SUPUNSIGNED ((lua_Number)(~(lua_Unsigned)0) + 1)
261 #define lua_number2unsigned(i,n) \
262 ((i)=(lua_Unsigned)((n) - floor((n)/SUPUNSIGNED)*SUPUNSIGNED))
264 #define lua_number2unsigned(i,n) ((i)=(lua_Unsigned)(n))
269 #if !defined(lua_unsigned2number)
272 #define lua_unsigned2number(u) \
273 (((u) <= (lua_Unsigned)INT_MAX) ? (lua_Number)(int)(u) : (lua_Number)(u))
278 #if defined(ltable_c) && !defined(luai_hashnum)
283 #define luai_hashnum(i,n) { int e; \
284 n = l_mathop(frexp)(n, &e) * (lua_Number)(INT_MAX - DBL_MAX_EXP); \
285 lua_number2int(i, n); i += e; }
294 #if !defined(HARDSTACKTESTS)
295 #define condmovestack(L) ((void)0)
298 #define condmovestack(L) luaD_reallocstack((L), (L)->stacksize)
301 #if !defined(HARDMEMTESTS)
302 #define condchangemem(L) condmovestack(L)
304 #define condchangemem(L) \
305 ((void)(!(G(L)->gcrunning) || (luaC_fullgc(L, 0), 1)))
unsigned LUA_INT32 lu_int32
#define LUAI_USER_ALIGNMENT_T
LUAI_UACNUMBER l_uacNumber
LUAI_USER_ALIGNMENT_T L_Umaxalign