For those too lazy to follow the link wrote:
>From: [email protected] (Erik Hougaard)
>This might be a stupid function, but is Lua missing a << >> bitshift function
yes, since it does not make sense for real numbers.
>and if so, how do I make it ?
how about this:
static void math_lshift (void)
{
int v=luaL_check_number(1);
int n=luaL_check_number(2);
lua_pushnumber(v<<n);
}
static void math_rshift (void)
{
int v=luaL_check_number(1);
int n=luaL_check_number(2);
lua_pushnumber(v>>n);
}
Do you need the speed? Lua uses always floats as its numbers, so perhaps it would be a better idea to extend the PRX concept of Lua Player and write performance critical parts in your own PRX in C.
Time will tell regarding performance. My project involves an AI player and a lot of tree searching, at the moment, performance looks like it might be acceptable, but I've been keeping an eye on the PRX concept.