back with 'L' for macros 'luai_num*', but now with a new macro
'luai_numinvalidop' to protect constant folding
This commit is contained in:
23
luaconf.h
23
luaconf.h
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: luaconf.h,v 1.189 2014/01/27 13:34:32 roberto Exp roberto $
|
||||
** $Id: luaconf.h,v 1.190 2014/02/26 15:27:56 roberto Exp roberto $
|
||||
** Configuration file for Lua
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -488,17 +488,17 @@
|
||||
/* the following operations need the math library */
|
||||
#if defined(lobject_c) || defined(lvm_c)
|
||||
#include <math.h>
|
||||
#define luai_nummod(a,b) ((a) - l_floor((a)/(b))*(b))
|
||||
#define luai_numpow(a,b) (l_mathop(pow)(a,b))
|
||||
#define luai_nummod(L,a,b) ((void)L, (a) - l_floor((a)/(b))*(b))
|
||||
#define luai_numpow(L,a,b) ((void)L, l_mathop(pow)(a,b))
|
||||
#endif
|
||||
|
||||
/* these are quite standard operations */
|
||||
#if defined(LUA_CORE)
|
||||
#define luai_numadd(a,b) ((a)+(b))
|
||||
#define luai_numsub(a,b) ((a)-(b))
|
||||
#define luai_nummul(a,b) ((a)*(b))
|
||||
#define luai_numdiv(a,b) ((a)/(b))
|
||||
#define luai_numunm(a) (-(a))
|
||||
#define luai_numadd(L,a,b) ((a)+(b))
|
||||
#define luai_numsub(L,a,b) ((a)-(b))
|
||||
#define luai_nummul(L,a,b) ((a)*(b))
|
||||
#define luai_numdiv(L,a,b) ((a)/(b))
|
||||
#define luai_numunm(L,a) (-(a))
|
||||
#define luai_numeq(a,b) ((a)==(b))
|
||||
#define luai_numlt(a,b) ((a)<(b))
|
||||
#define luai_numle(a,b) ((a)<=(b))
|
||||
@@ -506,6 +506,13 @@
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** The following macro checks whether an operation is not safe to be
|
||||
** performed by the constant folder. It should result in zero only if
|
||||
** the operation is safe.
|
||||
*/
|
||||
#define luai_numinvalidop(op,a,b) 0
|
||||
|
||||
|
||||
/*
|
||||
@@ LUA_INTEGER is the integer type used by Lua.
|
||||
|
||||
Reference in New Issue
Block a user