INNER CODE UNIT · C++

otherBn

margelo/react-native-bignumber · cpp/MGBigNumberHostObject.cpp:505

            std::shared_ptr<MGBigNumber> otherBn = std::make_shared<MGBigNumber>(thiz->ctx);
            BN_set_word(otherBn->bign, abs(other));
            BN_div(thiz->bign, nullptr, thiz->bign, otherBn->bign, thiz->ctx);
            if (other < 0)
            {
                MGBigNumHelper::BN_smart_neg(thiz->bign);
            }
            return jsi::Value::undefined();
        }));

        this->fields.push_back(HOST_LAMBDA("divn", {
            std::shared_ptr<MGBigNumber> thiz = thisValue.getObject(runtime).getHostObject<MGBigNumber>(runtime);
            const jsi::Value &otherValue = arguments[0];
            if (!otherValue.isNumber())
            {
                throw jsi::JSError(runtime, "divn expects integer");
            }
            int other = otherValue.asNumber();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…