INNER CODE UNIT · C++
res
margelo/react-native-bignumber · cpp/MGBigNumberHostObject.cpp:1475
std::shared_ptr<MGRedBigNum> res = std::make_shared<MGRedBigNum>(thiz->ctx, thiz->mctx, thiz->m);
BN_mod_add_quick(res->bign, thiz->bign, other->bign, thiz->m); // TODO (Szymon) are we sure that values are less than m?
return jsi::Object::createFromHostObject(runtime, res);
}));
this->fields.push_back(HOST_LAMBDA("redIAdd", {
std::shared_ptr<MGRedBigNum> thiz = thisValue.getObject(runtime).getHostObject<MGRedBigNum>(runtime);
const jsi::Value &otherValue = arguments[0];
if (!otherValue.isObject())
{
throw jsi::JSError(runtime, "redIAdd expects MGRedBigNum");
}
jsi::Object obj = otherValue.getObject(runtime);
if (!obj.isHostObject<MGRedBigNum>(runtime))
{
throw jsi::JSError(runtime, "redIAdd expects MGRedBigNum");
}