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 resultingBigIntwill be positive or negative. -
[in] word_count:words数组的长度。¥
[in] word_count: The length of thewordsarray. -
[in] words:uint64_tlittle-endian 64 位字数组。¥
[in] words: An array ofuint64_tlittle-endian 64-bit words. -
[out] result:代表 JavaScriptBigInt的napi_value。¥
[out] result: Anapi_valuerepresenting a JavaScriptBigInt.
如果 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 + …)