static JSValue js_bs_put_bits(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
{
	s64 val;
	s32 nb_bits;
	GET_JSBS
	if (!bs || (argc!=2)) return GF_JS_EXCEPTION(ctx);
	if (JS_ToInt64(ctx, &val, argv[0])) return GF_JS_EXCEPTION(ctx);
	if (JS_ToInt32(ctx, &nb_bits, argv[1])) return GF_JS_EXCEPTION(ctx);
	if (nb_bits<=32)
		gf_bs_write_int(bs, (u32) val, nb_bits);
	else
		gf_bs_write_long_int(bs, val, nb_bits);
	return JS_UNDEFINED;
}
static JSValue js_bs_put_bits(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
{
	s64 val;
	s32 nb_bits;
	GET_JSBS
	if (!bs || (argc!=2)) return GF_JS_EXCEPTION(ctx);
	if (JS_ToInt64(ctx, &val, argv[0])) return GF_JS_EXCEPTION(ctx);
	if (JS_ToInt32(ctx, &nb_bits, argv[1])) return GF_JS_EXCEPTION(ctx);
	if (nb_bits<=32)
		gf_bs_write_int(bs, (u32) val, nb_bits);
	else
		gf_bs_write_long_int(bs, val, nb_bits);
	return JS_UNDEFINED;
}