This commit is contained in:
pasky1382 2014-01-20 15:26:44 +00:00
parent 8530baee0c
commit 83591cda67
2 changed files with 36 additions and 1 deletions

View File

@ -19,6 +19,7 @@ namespace BizHawk.Client.Common
"ror",
"rshift",
"check",
"signed",
};
}
}
@ -50,7 +51,7 @@ namespace BizHawk.Client.Common
public static uint bit_rol(object val, object amt)
{
return (uint)((LuaInt(val) << LuaInt(amt))
return (uint)((LuaInt(val) << LuaInt(amt))
| (LuaInt(val) >> (32 - LuaInt(amt))));
}

View File

@ -0,0 +1,34 @@
using System;
namespace BizHawk.Client.Common
{
public class StringLuaLibrary : LuaLibraryBase
{
public override string Name { get { return "string"; } }
public override string[] Functions
{
get
{
return new[]
{
"hex",
"binary",
};
}
}
public static string string_hex(object num)
{
string hex = String.Format("{0:X}", LuaLong(num));
if (hex.Length == 1) hex = "0" + hex;
return hex;
}
public static string string_binary(object num)
{
string binary = Convert.ToString( LuaLong(num), 2);
binary = binary.TrimStart('0');
return binary;
}
}
}