INNER CODE UNIT · C++

res

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

            std::string res = MGBigNumHelper::bn2Str(thiz->bign, base, len);
            return jsi::String::createFromAscii(runtime, res.c_str());
        }));

        this->fields.push_back(HOST_LAMBDA("toNumber", {
            std::shared_ptr<MGBigNumber> thiz = thisValue.getObject(runtime).getHostObject<MGBigNumber>(runtime);

            bool neg = false;
            if (BN_is_negative(thiz->bign))
            {
                neg = true;
            }
            unsigned long temp = BN_get_word(thiz->bign);
            long long value = temp;
            value *= (neg) ? -1 : 1;
            return jsi::Value(runtime, (double)value);
        }));

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…