Skip to content

Commit

Permalink
fixed ambiguity in BCD constructor call, new version 1.0-6
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickfrey committed Nov 19, 2020
1 parent afd5e2c commit 6a8b283
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions luabcd-1.0-5.rockspec → luabcd-1.0-6.rockspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package = "LuaBcd"
version = "1.0-5"
version = "1.0-6"
source = {
url = "git://github.com/patrickfrey/luabcd",
tag = "1.0-5"
tag = "1.0-6"
}
description = {
summary = "BCD arithmetic for arbitrary large integers",
Expand Down
15 changes: 10 additions & 5 deletions src/lualib_bcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ struct LuaMethods
}
case LUA_TNUMBER:
{
bcd::BigInt operand( lua_tointeger( ls, 2));
long intarg = lua_tointeger( ls, 2);
bcd::BigInt operand( intarg);
lua_pushboolean( ls, (ud->m_value.*Method)( operand));
break;
}
Expand Down Expand Up @@ -304,7 +305,8 @@ struct LuaMethods
}
case LUA_TNUMBER:
{
bcd::BigInt operand( lua_tointeger( ls, 2));
long intarg = lua_tointeger( ls, 2);
bcd::BigInt operand( intarg);
UD* res_ud = newuserdata( ls);
res_ud->init();
res_ud->m_value = (ud->m_value.*Method)( operand);
Expand Down Expand Up @@ -373,7 +375,8 @@ struct LuaMethods
if (nn > 2) throw std::runtime_error( std::string("too many arguments calling ") + functionName);
if (lua_isnumber( ls, 2))
{
unsigned long operand = lua_tointeger( ls, 2);
long operand = lua_tointeger( ls, 2);
if (operand < 0) throw std::runtime_error( std::string("expected non negative integer as argument for ") + functionName);
UD* res_ud = newuserdata( ls); res_ud->init();
res_ud->m_value = ud->m_value.pow( operand);
}
Expand Down Expand Up @@ -412,7 +415,8 @@ struct LuaMethods
}
case LUA_TNUMBER:
{
bcd::BigInt operand( lua_tointeger( ls, 2));
long intarg = lua_tointeger( ls, 2);
bcd::BigInt operand( intarg);
UD* res1_ud = newuserdata( ls); res1_ud->init();
UD* res2_ud = newuserdata( ls); res2_ud->init();
std::pair<bcd::BigInt,bcd::BigInt> rr = (ud->m_value.div)( operand);
Expand Down Expand Up @@ -493,7 +497,8 @@ struct BitwiseBigIntLuaMethods
}
case LUA_TNUMBER:
{
bcd::BigInt operand( lua_tointeger( ls, 2));
long intarg = lua_tointeger( ls, 2);
bcd::BigInt operand( intarg);
UD* res_ud = newuserdata( ls);
res_ud->init();
res_ud->m_value = (ud->m_value.*Method)( operand, bd->m_ar);
Expand Down

0 comments on commit 6a8b283

Please sign in to comment.