Commit 942a717a authored by Jaromil's avatar Jaromil
Browse files

simple big number concatenation

can be improved to support variadic notation (a..b..c..d) if detecting
type of octet on the right side and acting accordingly.
parent 117567ed
......@@ -133,6 +133,18 @@ static int big_to_octet(lua_State *L) {
return 1;
static int big_concat(lua_State *L) {
big *l = big_arg(L,1); SAFE(l);
big *r = big_arg(L,2); SAFE(r);
// BIG_norm(l->val); BIG_norm(r->val);
int nlen = l->len + r->len;
octet *o = o_new(L, nlen +2); SAFE(o);
o->len = nlen;
return 1;
// useful to double-check big_to_octet():hex()
// this function is known to return good results
static int big_to_hex(lua_State *L) {
......@@ -280,6 +292,7 @@ int luaopen_big(lua_State *L) {
{"eq", big_eq},
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment