Skip to content

Commit

Permalink
Add JS_ToBigUint64
Browse files Browse the repository at this point in the history
Fixes: #376
  • Loading branch information
saghul committed Jun 4, 2024
1 parent c7bd411 commit e5673a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -12026,6 +12026,11 @@ int JS_ToBigInt64(JSContext *ctx, int64_t *pres, JSValue val)
return JS_ToBigInt64Free(ctx, pres, js_dup(val));
}

int JS_ToBigUint64(JSContext *ctx, uint64_t *pres, JSValue val)
{
return JS_ToBigInt64Free(ctx, (int64_t *)pres, js_dup(val));
}

static JSValue JS_NewBigInt(JSContext *ctx)
{
JSBigInt *p;
Expand Down
1 change: 1 addition & 0 deletions quickjs.h
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ JS_EXTERN int JS_ToIndex(JSContext *ctx, uint64_t *plen, JSValue val);
JS_EXTERN int JS_ToFloat64(JSContext *ctx, double *pres, JSValue val);
/* return an exception if 'val' is a Number */
JS_EXTERN int JS_ToBigInt64(JSContext *ctx, int64_t *pres, JSValue val);
JS_EXTERN int JS_ToBigUint64(JSContext *ctx, uint64_t *pres, JSValue val);
/* same as JS_ToInt64() but allow BigInt */
JS_EXTERN int JS_ToInt64Ext(JSContext *ctx, int64_t *pres, JSValue val);

Expand Down

0 comments on commit e5673a8

Please sign in to comment.