napi-rs/examples/napi/src/bigint.rs

20 lines
289 B
Rust
Raw Normal View History

2021-11-11 01:33:51 +09:00
use napi::bindgen_prelude::*;
#[napi]
fn bigint_add(a: BigInt, b: BigInt) -> u128 {
a.get_u128().1 + b.get_u128().1
}
#[napi]
fn create_big_int() -> BigInt {
BigInt {
words: vec![100u64, 200u64],
sign_bit: true,
}
}
#[napi]
fn create_big_int_i64() -> i64n {
i64n(100)
}