]> git.kaiwu.me - quickjs.git/commitdiff
compilation fix
authorFabrice Bellard <fabrice@bellard.org>
Tue, 18 Mar 2025 17:45:21 +0000 (18:45 +0100)
committerFabrice Bellard <fabrice@bellard.org>
Tue, 18 Mar 2025 17:45:21 +0000 (18:45 +0100)
quickjs.c

index 1003dd45842350f2ffbbac7980bfa7b64419fb73..76dfcb527111e0ffbf57954880eb906c6bcecbf1 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -379,7 +379,7 @@ typedef struct JSBigInt {
 
 /* this bigint structure can hold a 64 bit integer */
 typedef struct {
-    JSBigInt big_int;
+    js_limb_t big_int_buf[sizeof(JSBigInt) / sizeof(js_limb_t)]; /* for JSBigInt */
     /* must come just after */
     js_limb_t tab[(64 + JS_LIMB_BITS - 1) / JS_LIMB_BITS];
 } JSBigIntBuf;
@@ -10195,7 +10195,7 @@ static JSBigInt *js_bigint_new(JSContext *ctx, int len)
 
 static JSBigInt *js_bigint_set_si(JSBigIntBuf *buf, js_slimb_t a)
 {
-    JSBigInt *r = &buf->big_int;
+    JSBigInt *r = (JSBigInt *)buf->big_int_buf;
     r->len = 1;
     r->tab[0] = a;
     return r;
@@ -10901,7 +10901,7 @@ static JSBigInt *js_bigint_from_float64(JSContext *ctx, int *pres, double a1)
     }
     
     /* the integer is mant*2^e */
-    r = &buf.big_int;
+    r = (JSBigInt *)buf.big_int_buf;
 #if JS_LIMB_BITS == 64
     r->len = 1;
     r->tab[0] = mant;