Skip to content

Commit ca6b452

Browse files
committed
feat(neon): JsBigInt
1 parent 11b80e4 commit ca6b452

File tree

10 files changed

+1127
-2
lines changed

10 files changed

+1127
-2
lines changed

Cargo.lock

Lines changed: 113 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/neon/src/sys/bindings/functions.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,40 @@ mod napi6 {
345345
) -> Status;
346346

347347
fn get_instance_data(env: Env, data: *mut *mut c_void) -> Status;
348+
349+
fn create_bigint_int64(env: Env, value: i64, result: *mut Value) -> Status;
350+
351+
fn create_bigint_uint64(env: Env, value: u64, result: *mut Value) -> Status;
352+
353+
fn create_bigint_words(
354+
env: Env,
355+
sign_bit: i32,
356+
word_count: usize,
357+
words: *const u64,
358+
result: *mut Value,
359+
) -> Status;
360+
361+
fn get_value_bigint_int64(
362+
env: Env,
363+
value: Value,
364+
result: *mut i64,
365+
lossless: *mut bool,
366+
) -> Status;
367+
368+
fn get_value_bigint_uint64(
369+
env: Env,
370+
value: Value,
371+
result: *mut u64,
372+
lossless: *mut bool,
373+
) -> Status;
374+
375+
fn get_value_bigint_words(
376+
env: Env,
377+
value: Value,
378+
sign_bit: *mut i64,
379+
word_count: *mut usize,
380+
words: *mut u64,
381+
) -> Status;
348382
}
349383
);
350384
}

crates/neon/src/sys/tag.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,8 @@ pub unsafe fn check_object_type_tag(env: Env, object: Local, tag: &super::TypeTa
132132
);
133133
result
134134
}
135+
136+
#[cfg(feature = "napi-6")]
137+
pub unsafe fn is_bigint(env: Env, val: Local) -> bool {
138+
is_type(env, val, napi::ValueType::BigInt)
139+
}

0 commit comments

Comments
 (0)