napi_create_bigint_words


napi_status napi_create_bigint_words(napi_env env,
                                     int sign_bit,
                                     size_t word_count,
                                     const uint64_t* words,
                                     napi_value* result); 
  • [in] env:调用 API 的环境。

    ¥[in] env: The environment that the API is invoked under.

  • [in] sign_bit:确定生成的 BigInt 是正数还是负数。

    ¥[in] sign_bit: Determines if the resulting BigInt will be positive or negative.

  • [in] word_countwords 数组的长度。

    ¥[in] word_count: The length of the words array.

  • [in] wordsuint64_t little-endian 64 位字数组。

    ¥[in] words: An array of uint64_t little-endian 64-bit words.

  • [out] result:代表 JavaScript BigIntnapi_value

    ¥[out] result: A napi_value representing a JavaScript BigInt.

如果 API 成功,则返回 napi_ok

¥Returns napi_ok if the API succeeded.

此 API 将一组无符号 64 位字转换为单个 BigInt 值。

¥This API converts an array of unsigned 64-bit words into a single BigInt value.

生成的 BigInt 计算如下:(–1)sign_bit (words[0] × (264)0 + words[1] × (264)1 + …)

¥The resulting BigInt is calculated as: (–1)sign_bit (words[0] × (264)0 + words[1] × (264)1 + …)