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] valuenapi_value 代表 JavaScript BigInt

    ¥[in] value: napi_value representing JavaScript BigInt.

  • [out] sign_bit:表示 JavaScript BigInt 是正数还是负数的整数。

    ¥[out] sign_bit: Integer representing if the JavaScript BigInt is positive or negative.

  • [in/out] word_count:必须初始化为 words 数组的长度。返回时,它将被设置为存储此 BigInt 所需的实际字数。

    ¥[in/out] word_count: Must be initialized to the length of the words array. Upon return, it will be set to the actual number of words that would be needed to store this BigInt.

  • [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_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.