File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -215,12 +215,18 @@ typedef struct JSValue {
215
215
#define JS_VALUE_GET_FLOAT64 (v ) ((v).u.float64)
216
216
#define JS_VALUE_GET_PTR (v ) ((v).u.ptr)
217
217
218
+ #ifdef __cplusplus
219
+ #define JS_MKVAL (tag , val ) JSValue{ JSValueUnion{ .int32 = val }, tag }
220
+ #define JS_MKPTR (tag , p ) JSValue{ JSValueUnion{ .ptr = p }, tag }
221
+ #define JS_NAN JSValue{ .u.float64 = JS_FLOAT64_NAN, JS_TAG_FLOAT64 }
222
+ #else
218
223
#define JS_MKVAL (tag , val ) (JSValue){ (JSValueUnion){ .int32 = val }, tag }
219
224
#define JS_MKPTR (tag , p ) (JSValue){ (JSValueUnion){ .ptr = p }, tag }
225
+ #define JS_NAN (JSValue){ .u.float64 = JS_FLOAT64_NAN, JS_TAG_FLOAT64 }
226
+ #endif
220
227
221
228
#define JS_TAG_IS_FLOAT64 (tag ) ((unsigned)(tag) == JS_TAG_FLOAT64)
222
229
223
- #define JS_NAN (JSValue){ .u.float64 = JS_FLOAT64_NAN, JS_TAG_FLOAT64 }
224
230
225
231
static inline JSValue __JS_NewFloat64 (JSContext * ctx , double d )
226
232
{
You can’t perform that action at this time.
0 commit comments