Lua bit.checkbit() function, returns if a specified bit is on/off.
This commit is contained in:
parent
df89951325
commit
1a0e98b7ad
|
@ -1,4 +1,5 @@
|
|||
namespace BizHawk.Client.Common
|
||||
using System;
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public class BitLuaLibrary : LuaLibraryBase
|
||||
{
|
||||
|
@ -17,6 +18,7 @@
|
|||
"rol",
|
||||
"ror",
|
||||
"rshift",
|
||||
"check",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -62,5 +64,11 @@
|
|||
{
|
||||
return (uint)(LuaInt(val) >> LuaInt(amt));
|
||||
}
|
||||
|
||||
public static bool bit_check(object num, object pos)
|
||||
{
|
||||
var value = Convert.ToInt64(LuaLong(num));
|
||||
return (value & (1 << (int)(LuaInt(pos)))) != 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue