From 756c119ddcea37f1fae491dc175c8b7801f8e8b5 Mon Sep 17 00:00:00 2001 From: Daniel Santos <47725160+DanielSant0s@users.noreply.github.com> Date: Wed, 28 Jun 2023 10:29:03 -0300 Subject: [PATCH] Implement more Float32 support --- src/quickjs/quickjs.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/quickjs/quickjs.c b/src/quickjs/quickjs.c index 122178f..cbdfaf9 100644 --- a/src/quickjs/quickjs.c +++ b/src/quickjs/quickjs.c @@ -14432,10 +14432,10 @@ static no_inline __exception int js_unary_arith_slow(JSContext *ctx, f = JS_VALUE_GET_FLOAT32(op1); switch(op) { case OP_inc: - f++; + f+=1.0f; break; case OP_dec: - f--; + f-=1.0f; break; case OP_plus: break; @@ -36169,6 +36169,15 @@ static JSValue JS_ReadObjectRec(BCReaderState *s) obj = __JS_NewFloat64(ctx, u.d); } break; + case BC_TAG_FLOAT32: + { + JSFloat32Union u; + if (bc_get_u32(s, &u.u32)) + return JS_EXCEPTION; + bc_read_trace(s, "%g\n", u.f); + obj = custom_JS_NewFloat32(ctx, u.f); + } + break; case BC_TAG_STRING: { JSString *p;