24 typedef LUAI_MEM
l_mem;
25 #elif LUAI_BITSINT >= 32
27 typedef ptrdiff_t
l_mem;
39 #define MAX_SIZET ((size_t)(~(size_t)0))
42 #define MAX_SIZE (sizeof(size_t) < sizeof(lua_Integer) ? MAX_SIZET \
43 : (size_t)(LUA_MAXINTEGER))
46 #define MAX_LUMEM ((lu_mem)(~(lu_mem)0))
48 #define MAX_LMEM ((l_mem)(MAX_LUMEM >> 1))
51 #define MAX_INT INT_MAX
59 #define point2uint(p) ((unsigned int)((size_t)(p) & UINT_MAX))
64 #if defined(LUAI_USER_ALIGNMENT_T)
84 #if defined(lua_assert)
85 #define check_exp(c,e) (lua_assert(c), (e))
87 #define lua_longassert(c) ((c) ? (void)0 : lua_assert(0))
89 #define lua_assert(c) ((void)0)
90 #define check_exp(c,e) (e)
91 #define lua_longassert(c) ((void)0)
97 #if !defined(luai_apicheck)
98 #define luai_apicheck(l,e) lua_assert(e)
101 #define api_check(l,e,msg) luai_apicheck(l,(e) && msg)
106 #define UNUSED(x) ((void)(x))
111 #define cast(t, exp) ((t)(exp))
113 #define cast_void(i) cast(void, (i))
114 #define cast_byte(i) cast(lu_byte, (i))
115 #define cast_num(i) cast(lua_Number, (i))
116 #define cast_int(i) cast(int, (i))
117 #define cast_uchar(i) cast(unsigned char, (i))
121 #if !defined(l_castS2U)
122 #define l_castS2U(i) ((lua_Unsigned)(i))
130 #if !defined(l_castU2S)
131 #define l_castU2S(i) ((lua_Integer)(i))
138 #if defined(__GNUC__)
139 #define l_noret void __attribute__((noreturn))
140 #elif defined(_MSC_VER) && _MSC_VER >= 1200
141 #define l_noret void __declspec(noreturn)
152 #if !defined(LUAI_MAXCCALLS)
153 #define LUAI_MAXCCALLS 200
162 #if LUAI_BITSINT >= 32
176 #if !defined(LUAI_MAXSHORTLEN)
177 #define LUAI_MAXSHORTLEN 40
187 #if !defined(MINSTRTABSIZE)
188 #define MINSTRTABSIZE 128
197 #if !defined(STRCACHE_N)
198 #define STRCACHE_N 53
204 #if !defined(LUA_MINBUFFER)
205 #define LUA_MINBUFFER 32
213 #if !defined(lua_lock)
214 #define lua_lock(L) ((void) 0)
215 #define lua_unlock(L) ((void) 0)
222 #if !defined(luai_threadyield)
223 #define luai_threadyield(L) {lua_unlock(L); lua_lock(L);}
232 #if !defined(luai_userstateopen)
233 #define luai_userstateopen(L) ((void)L)
236 #if !defined(luai_userstateclose)
237 #define luai_userstateclose(L) ((void)L)
240 #if !defined(luai_userstatethread)
241 #define luai_userstatethread(L,L1) ((void)L)
244 #if !defined(luai_userstatefree)
245 #define luai_userstatefree(L,L1) ((void)L)
248 #if !defined(luai_userstateresume)
249 #define luai_userstateresume(L,n) ((void)L)
252 #if !defined(luai_userstateyield)
253 #define luai_userstateyield(L,n) ((void)L)
263 #if !defined(luai_numidiv)
264 #define luai_numidiv(L,a,b) ((void)L, l_floor(luai_numdiv(L,a,b)))
268 #if !defined(luai_numdiv)
269 #define luai_numdiv(L,a,b) ((a)/(b))
279 #if !defined(luai_nummod)
280 #define luai_nummod(L,a,b,m) \
281 { (m) = l_mathop(fmod)(a,b); if ((m)*(b) < 0) (m) += (b); }
285 #if !defined(luai_numpow)
286 #define luai_numpow(L,a,b) ((void)L, l_mathop(pow)(a,b))
290 #if !defined(luai_numadd)
291 #define luai_numadd(L,a,b) ((a)+(b))
292 #define luai_numsub(L,a,b) ((a)-(b))
293 #define luai_nummul(L,a,b) ((a)*(b))
294 #define luai_numunm(L,a) (-(a))
295 #define luai_numeq(a,b) ((a)==(b))
296 #define luai_numlt(a,b) ((a)<(b))
297 #define luai_numle(a,b) ((a)<=(b))
298 #define luai_numisnan(a) (!luai_numeq((a), (a)))
308 #if !defined(HARDSTACKTESTS)
309 #define condmovestack(L,pre,pos) ((void)0)
312 #define condmovestack(L,pre,pos) \
313 { int sz_ = (L)->stacksize; pre; luaD_reallocstack((L), sz_); pos; }
316 #if !defined(HARDMEMTESTS)
317 #define condchangemem(L,pre,pos) ((void)0)
319 #define condchangemem(L,pre,pos) \
320 { if (G(L)->gcrunning) { pre; luaC_fullgc(L, 0); pos; } }
unsigned long Instruction