This commit is contained in:
2026-01-08 21:00:56 -06:00
parent 69245f82db
commit 8403883b9d

View File

@@ -38880,6 +38880,26 @@ static JSValue js_blob_w16(JSContext *ctx, JSValueConst this_val,
return JS_NULL;
}
/* blob.w32(value) - write 32-bit value */
static JSValue js_blob_w32(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
if (argc < 1)
return JS_ThrowTypeError(ctx, "w32(value) requires 1 argument");
blob *bd = js_get_blob(ctx, this_val);
if (!bd)
return JS_ThrowTypeError(ctx, "w32: not called on a blob");
int32_t value;
if (JS_ToInt32(ctx, &value, argv[0]) < 0) return JS_EXCEPTION;
if (blob_write_bytes(bd, &value, sizeof(int32_t)) < 0)
return JS_ThrowTypeError(ctx, "w32: cannot write");
return JS_NULL;
}
/* blob.wf(value) - write float */
static JSValue js_blob_wf(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
{
@@ -39080,6 +39100,7 @@ static const JSCFunctionListEntry js_blob_proto_funcs[] = {
JS_CFUNC_DEF("write_pad", 1, js_blob_write_pad),
JS_CFUNC_DEF("wf", 1, js_blob_wf),
JS_CFUNC_DEF("w16", 1, js_blob_w16),
JS_CFUNC_DEF("w32", 1, js_blob_w32),
/* Read methods */
JS_CFUNC_DEF("read_logical", 1, js_blob_read_logical),