diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-03-06 13:15:18 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-03-06 13:15:18 -0300 |
commit | 5ff1c18a715b842a6146a6a07d99c84f48cac999 (patch) | |
tree | b90579a688fd971f80e7628cba179fdf389a27c8 /luaconf.h | |
parent | 99ac4a260fc1bf958515c1816d866852194493f2 (diff) | |
download | lua-5ff1c18a715b842a6146a6a07d99c84f48cac999.tar.gz lua-5ff1c18a715b842a6146a6a07d99c84f48cac999.tar.bz2 lua-5ff1c18a715b842a6146a6a07d99c84f48cac999.zip |
back with 'L' for macros 'luai_num*', but now with a new macro
'luai_numinvalidop' to protect constant folding
Diffstat (limited to 'luaconf.h')
-rw-r--r-- | luaconf.h | 23 |
1 files changed, 15 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: luaconf.h,v 1.189 2014/01/27 13:34:32 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.190 2014/02/26 15:27:56 roberto Exp roberto $ |
3 | ** Configuration file for Lua | 3 | ** Configuration file for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -488,17 +488,17 @@ | |||
488 | /* the following operations need the math library */ | 488 | /* the following operations need the math library */ |
489 | #if defined(lobject_c) || defined(lvm_c) | 489 | #if defined(lobject_c) || defined(lvm_c) |
490 | #include <math.h> | 490 | #include <math.h> |
491 | #define luai_nummod(a,b) ((a) - l_floor((a)/(b))*(b)) | 491 | #define luai_nummod(L,a,b) ((void)L, (a) - l_floor((a)/(b))*(b)) |
492 | #define luai_numpow(a,b) (l_mathop(pow)(a,b)) | 492 | #define luai_numpow(L,a,b) ((void)L, l_mathop(pow)(a,b)) |
493 | #endif | 493 | #endif |
494 | 494 | ||
495 | /* these are quite standard operations */ | 495 | /* these are quite standard operations */ |
496 | #if defined(LUA_CORE) | 496 | #if defined(LUA_CORE) |
497 | #define luai_numadd(a,b) ((a)+(b)) | 497 | #define luai_numadd(L,a,b) ((a)+(b)) |
498 | #define luai_numsub(a,b) ((a)-(b)) | 498 | #define luai_numsub(L,a,b) ((a)-(b)) |
499 | #define luai_nummul(a,b) ((a)*(b)) | 499 | #define luai_nummul(L,a,b) ((a)*(b)) |
500 | #define luai_numdiv(a,b) ((a)/(b)) | 500 | #define luai_numdiv(L,a,b) ((a)/(b)) |
501 | #define luai_numunm(a) (-(a)) | 501 | #define luai_numunm(L,a) (-(a)) |
502 | #define luai_numeq(a,b) ((a)==(b)) | 502 | #define luai_numeq(a,b) ((a)==(b)) |
503 | #define luai_numlt(a,b) ((a)<(b)) | 503 | #define luai_numlt(a,b) ((a)<(b)) |
504 | #define luai_numle(a,b) ((a)<=(b)) | 504 | #define luai_numle(a,b) ((a)<=(b)) |
@@ -506,6 +506,13 @@ | |||
506 | #endif | 506 | #endif |
507 | 507 | ||
508 | 508 | ||
509 | /* | ||
510 | ** The following macro checks whether an operation is not safe to be | ||
511 | ** performed by the constant folder. It should result in zero only if | ||
512 | ** the operation is safe. | ||
513 | */ | ||
514 | #define luai_numinvalidop(op,a,b) 0 | ||
515 | |||
509 | 516 | ||
510 | /* | 517 | /* |
511 | @@ LUA_INTEGER is the integer type used by Lua. | 518 | @@ LUA_INTEGER is the integer type used by Lua. |