mirror of https://github.com/rusefi/lua.git
new function 'math.ult' (unsigned less than)
This commit is contained in:
parent
03bbe1baf1
commit
925d1b59f9
11
lmathlib.c
11
lmathlib.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lmathlib.c,v 1.106 2014/07/16 13:47:13 roberto Exp roberto $
|
** $Id: lmathlib.c,v 1.107 2014/07/17 12:30:53 roberto Exp roberto $
|
||||||
** Standard mathematical library
|
** Standard mathematical library
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -164,6 +164,14 @@ static int math_sqrt (lua_State *L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int math_ult (lua_State *L) {
|
||||||
|
lua_Integer a = luaL_checkinteger(L, 1);
|
||||||
|
lua_Integer b = luaL_checkinteger(L, 2);
|
||||||
|
lua_pushboolean(L, (lua_Unsigned)a < (lua_Unsigned)b);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int math_log (lua_State *L) {
|
static int math_log (lua_State *L) {
|
||||||
lua_Number x = luaL_checknumber(L, 1);
|
lua_Number x = luaL_checknumber(L, 1);
|
||||||
lua_Number res;
|
lua_Number res;
|
||||||
|
@ -343,6 +351,7 @@ static const luaL_Reg mathlib[] = {
|
||||||
{"tointeger", math_toint},
|
{"tointeger", math_toint},
|
||||||
{"floor", math_floor},
|
{"floor", math_floor},
|
||||||
{"fmod", math_fmod},
|
{"fmod", math_fmod},
|
||||||
|
{"ult", math_ult},
|
||||||
{"log", math_log},
|
{"log", math_log},
|
||||||
{"max", math_max},
|
{"max", math_max},
|
||||||
{"min", math_min},
|
{"min", math_min},
|
||||||
|
|
Loading…
Reference in New Issue