diff options
author | Dmitry Volyntsev <xeioexception@gmail.com> | 2024-05-08 14:17:00 -0700 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-05-30 18:55:56 +0200 |
commit | bfdbadd61fa3d52bcd764862a115748686d62593 (patch) | |
tree | ed35c70d70cc3ceb0ad15703955bf53ec4b377b2 /lib/quickjs/quickjs.h | |
parent | a407f86065a5ae968a54cc566a71c6d596e5a6cd (diff) | |
download | chawan-bfdbadd61fa3d52bcd764862a115748686d62593.tar.gz |
Add `JS_NewTypedArray()` (#272)
Diffstat (limited to 'lib/quickjs/quickjs.h')
-rw-r--r-- | lib/quickjs/quickjs.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/quickjs/quickjs.h b/lib/quickjs/quickjs.h index 7b6edd1f..92caf3f5 100644 --- a/lib/quickjs/quickjs.h +++ b/lib/quickjs/quickjs.h @@ -832,6 +832,23 @@ JSValue JS_NewArrayBuffer(JSContext *ctx, uint8_t *buf, size_t len, JSValue JS_NewArrayBufferCopy(JSContext *ctx, const uint8_t *buf, size_t len); void JS_DetachArrayBuffer(JSContext *ctx, JSValueConst obj); uint8_t *JS_GetArrayBuffer(JSContext *ctx, size_t *psize, JSValueConst obj); + +typedef enum JSTypedArrayEnum { + JS_TYPED_ARRAY_UINT8C = 0, + JS_TYPED_ARRAY_INT8, + JS_TYPED_ARRAY_UINT8, + JS_TYPED_ARRAY_INT16, + JS_TYPED_ARRAY_UINT16, + JS_TYPED_ARRAY_INT32, + JS_TYPED_ARRAY_UINT32, + JS_TYPED_ARRAY_BIG_INT64, + JS_TYPED_ARRAY_BIG_UINT64, + JS_TYPED_ARRAY_FLOAT32, + JS_TYPED_ARRAY_FLOAT64, +} JSTypedArrayEnum; + +JSValue JS_NewTypedArray(JSContext *ctx, int argc, JSValueConst *argv, + JSTypedArrayEnum array_type); JSValue JS_GetTypedArrayBuffer(JSContext *ctx, JSValueConst obj, size_t *pbyte_offset, size_t *pbyte_length, |