diff options
| -rw-r--r-- | ltests.c | 10 |
1 files changed, 9 insertions, 1 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 2.203 2015/03/11 16:10:41 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.204 2015/03/13 16:24:50 roberto Exp roberto $ |
| 3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -916,6 +916,13 @@ static int int2fb_aux (lua_State *L) { | |||
| 916 | } | 916 | } |
| 917 | 917 | ||
| 918 | 918 | ||
| 919 | static int log2_aux (lua_State *L) { | ||
| 920 | unsigned int x = (unsigned int)luaL_checkinteger(L, 1); | ||
| 921 | lua_pushinteger(L, luaO_ceillog2(x)); | ||
| 922 | return 1; | ||
| 923 | } | ||
| 924 | |||
| 925 | |||
| 919 | struct Aux { jmp_buf jb; const char *paniccode; lua_State *L; }; | 926 | struct Aux { jmp_buf jb; const char *paniccode; lua_State *L; }; |
| 920 | 927 | ||
| 921 | /* | 928 | /* |
| @@ -1508,6 +1515,7 @@ static const struct luaL_Reg tests_funcs[] = { | |||
| 1508 | {"getref", getref}, | 1515 | {"getref", getref}, |
| 1509 | {"hash", hash_query}, | 1516 | {"hash", hash_query}, |
| 1510 | {"int2fb", int2fb_aux}, | 1517 | {"int2fb", int2fb_aux}, |
| 1518 | {"log2", log2_aux}, | ||
| 1511 | {"limits", get_limits}, | 1519 | {"limits", get_limits}, |
| 1512 | {"listcode", listcode}, | 1520 | {"listcode", listcode}, |
| 1513 | {"listk", listk}, | 1521 | {"listk", listk}, |
