diff options
-rw-r--r-- | lapi.c | 4 | ||||
-rw-r--r-- | ltable.c | 4 | ||||
-rw-r--r-- | luaconf.h | 7 | ||||
-rw-r--r-- | lvm.c | 4 |
4 files changed, 10 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.181 2013/06/04 19:34:51 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.182 2013/06/14 18:32:45 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -390,7 +390,7 @@ LUA_API lua_Unsigned lua_tounsignedx (lua_State *L, int idx, int *pisnum) { | |||
390 | const lua_Number twop = (~(lua_Unsigned)0) + cast_num(1); | 390 | const lua_Number twop = (~(lua_Unsigned)0) + cast_num(1); |
391 | lua_Number n = fltvalue(o); | 391 | lua_Number n = fltvalue(o); |
392 | int neg = 0; | 392 | int neg = 0; |
393 | n = l_mathop(floor)(n); | 393 | n = l_floor(n); |
394 | if (n < 0) { | 394 | if (n < 0) { |
395 | neg = 1; | 395 | neg = 1; |
396 | n = -n; | 396 | n = -n; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 2.76 2013/05/27 12:43:37 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 2.77 2013/05/29 14:05:03 roberto Exp roberto $ |
3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -70,7 +70,7 @@ | |||
70 | /* checks whether a float has a value representable as a lua_Integer | 70 | /* checks whether a float has a value representable as a lua_Integer |
71 | (and does the conversion if so) */ | 71 | (and does the conversion if so) */ |
72 | #define numisinteger(x,i) \ | 72 | #define numisinteger(x,i) \ |
73 | (((x) == l_mathop(floor)(x)) && luaV_numtointeger(x, i)) | 73 | (((x) == l_floor(x)) && luaV_numtointeger(x, i)) |
74 | 74 | ||
75 | 75 | ||
76 | #define dummynode (&dummynode_) | 76 | #define dummynode (&dummynode_) |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: luaconf.h,v 1.181 2013/05/26 13:35:52 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.182 2013/06/13 19:35:08 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 | */ |
@@ -423,6 +423,7 @@ | |||
423 | #define LUA_NUMBER_FMT "%.7g" | 423 | #define LUA_NUMBER_FMT "%.7g" |
424 | 424 | ||
425 | #define l_mathop(op) op##f | 425 | #define l_mathop(op) op##f |
426 | #define l_floor(x) (floorf(x)) | ||
426 | 427 | ||
427 | #define lua_str2number(s,p) strtof((s), (p)) | 428 | #define lua_str2number(s,p) strtof((s), (p)) |
428 | 429 | ||
@@ -438,6 +439,7 @@ | |||
438 | #define LUA_NUMBER_FMT "%.14g" | 439 | #define LUA_NUMBER_FMT "%.14g" |
439 | 440 | ||
440 | #define l_mathop(op) op | 441 | #define l_mathop(op) op |
442 | #define l_floor(x) (floor(x)) | ||
441 | 443 | ||
442 | #define lua_str2number(s,p) strtod((s), (p)) | 444 | #define lua_str2number(s,p) strtod((s), (p)) |
443 | 445 | ||
@@ -452,7 +454,6 @@ | |||
452 | #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) | 454 | #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) |
453 | 455 | ||
454 | 456 | ||
455 | |||
456 | /* | 457 | /* |
457 | @@ The luai_num* macros define the primitive operations over numbers. | 458 | @@ The luai_num* macros define the primitive operations over numbers. |
458 | @* They should work for any size of floating numbers. | 459 | @* They should work for any size of floating numbers. |
@@ -461,7 +462,7 @@ | |||
461 | /* the following operations need the math library */ | 462 | /* the following operations need the math library */ |
462 | #if defined(lobject_c) || defined(lvm_c) | 463 | #if defined(lobject_c) || defined(lvm_c) |
463 | #include <math.h> | 464 | #include <math.h> |
464 | #define luai_nummod(L,a,b) ((a) - l_mathop(floor)((a)/(b))*(b)) | 465 | #define luai_nummod(L,a,b) ((a) - l_floor((a)/(b))*(b)) |
465 | #define luai_numpow(L,a,b) (l_mathop(pow)(a,b)) | 466 | #define luai_numpow(L,a,b) (l_mathop(pow)(a,b)) |
466 | #endif | 467 | #endif |
467 | 468 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.173 2013/06/07 19:02:05 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.174 2013/06/19 14:27:00 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -92,7 +92,7 @@ int luaV_tointeger_ (const TValue *obj, lua_Integer *p) { | |||
92 | lua_Number n; | 92 | lua_Number n; |
93 | lua_assert(!ttisinteger(obj)); | 93 | lua_assert(!ttisinteger(obj)); |
94 | if (tonumber(obj, &n)) { | 94 | if (tonumber(obj, &n)) { |
95 | n = l_mathop(floor)(n); | 95 | n = l_floor(n); |
96 | return luaV_numtointeger(n, p); | 96 | return luaV_numtointeger(n, p); |
97 | } | 97 | } |
98 | else return 0; | 98 | else return 0; |