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] value:表示 JavaScript BigIntnapi_value
  • [out] sign_bit:表示 JavaScript BigInt 是正数还是负数的整数。
  • [输入/输出] word_count:必须初始化为 words 数组的长度。返回时,它将被设置为存储此 BigInt 所需的实际单词数。
  • [out] words:指向一个预分配的64位字数组的指针。

如果 API 成功,则返回 napi_ok

【Returns napi_ok if the API succeeded.】

此 API 将单个 BigInt 值转换为符号位、64 位小端数组以及数组中的元素数量。sign_bitwords 都可以设置为 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.】