napi_get_value_bigint_words
napi_status napi_get_value_bigint_words(napi_env env,
napi_value value,
int* sign_bit,
size_t* word_count,
uint64_t* words); -
[in] env:调用 API 的环境。¥
[in] env: The environment that the API is invoked under. -
[in] value:napi_value代表 JavaScriptBigInt。¥
[in] value:napi_valuerepresenting JavaScriptBigInt. -
[out] sign_bit:表示 JavaScriptBigInt是正数还是负数的整数。¥
[out] sign_bit: Integer representing if the JavaScriptBigIntis positive or negative. -
[in/out] word_count:必须初始化为words数组的长度。返回时,它将被设置为存储此BigInt所需的实际字数。¥
[in/out] word_count: Must be initialized to the length of thewordsarray. Upon return, it will be set to the actual number of words that would be needed to store thisBigInt. -
[out] words:指向预分配的 64 位字数组的指针。¥
[out] words: Pointer to a pre-allocated 64-bit word array.
如果 API 成功,则返回 napi_ok。
¥Returns napi_ok if the API succeeded.
此 API 将单个 BigInt 值转换为符号位、64 位小端数组和数组中的元素数。sign_bit 和 words 可能都设置为 NULL,以便只得到 word_count。
¥This API converts a single BigInt value into a sign bit, 64-bit little-endian
array, and the number of elements in the array. sign_bit and words may be
both set to NULL, in order to get only word_count.