Fix quickjs build on linux

master
Jeremy Hu 2019-07-22 07:44:16 +09:30
parent a7758fcccd
commit 930b7ad4a6
2 changed files with 28 additions and 3 deletions

View File

@ -72,7 +72,7 @@
/* define to include Atomics.* operations which depend on the OS /* define to include Atomics.* operations which depend on the OS
threads */ threads */
#if !defined(EMSCRIPTEN) #if !defined(EMSCRIPTEN)
#if !defined(_MSC_VER) #if !defined(_MSC_VER) && !defined(__linux__)
#define CONFIG_ATOMICS #define CONFIG_ATOMICS
#endif #endif
#endif #endif

View File

@ -201,12 +201,37 @@ typedef struct JSValue {
#define JS_VALUE_GET_FLOAT64(v) ((v).u.float64) #define JS_VALUE_GET_FLOAT64(v) ((v).u.float64)
#define JS_VALUE_GET_PTR(v) ((v).u.ptr) #define JS_VALUE_GET_PTR(v) ((v).u.ptr)
#define JS_MKVAL(tag, val) (JSValue){ .u.int32 = val, tag } //#define JS_MKVAL(tag, val) (JSValue){ .u.int32 = val, tag }
#define JS_MKPTR(tag, p) (JSValue){ .u.ptr = p, tag } static inline JSValue JS_MKVAL(uint64_t tag, int32_t val)
{
JSValue value = {};
value.u.int32 = val;
value.tag = tag;
return value;
}
//#define JS_MKPTR(tag, p) (JSValue){ .u.ptr = p, tag }
static inline JSValue JS_MKPTR(uint64_t tag, void *ptr)
{
JSValue value = {};
value.u.ptr = ptr;
value.tag = tag;
return value;
}
#define JS_TAG_IS_FLOAT64(tag) ((unsigned)(tag) == JS_TAG_FLOAT64) #define JS_TAG_IS_FLOAT64(tag) ((unsigned)(tag) == JS_TAG_FLOAT64)
#define JS_NAN (JSValue){ .u.float64 = JS_FLOAT64_NAN, JS_TAG_FLOAT64 } #define JS_NAN (JSValue){ .u.float64 = JS_FLOAT64_NAN, JS_TAG_FLOAT64 }
/*
static inline JSValue JS_NAN_()
{
JSValue value = {};
value.u.float64 = JS_FLOAT64_NAN;
value.tag = JS_TAG_FLOAT64;
return value;
}
#define JS_NAN JS_NAN_()
*/
static inline JSValue __JS_NewFloat64(JSContext *ctx, double d) static inline JSValue __JS_NewFloat64(JSContext *ctx, double d)
{ {