mirror of
https://github.com/DoneJS-Runtime/quickjs-done-nextgen.git
synced 2025-01-09 17:43:15 +00:00
Work around msvc definition of NAN
NAN is reportedly no longer a compile-time expression in some versions of MSVC. Work around that by minting a NaN from a uint64. Fixes: https://github.com/quickjs-ng/quickjs/issues/622 Fixes: https://github.com/quickjs-ng/quickjs/issues/693
This commit is contained in:
parent
bdadad97cd
commit
f93dd58ea0
2 changed files with 4 additions and 2 deletions
|
@ -41116,7 +41116,7 @@ static const JSCFunctionListEntry js_number_funcs[] = {
|
||||||
JS_CFUNC_DEF("isSafeInteger", 1, js_number_isSafeInteger ),
|
JS_CFUNC_DEF("isSafeInteger", 1, js_number_isSafeInteger ),
|
||||||
JS_PROP_DOUBLE_DEF("MAX_VALUE", 1.7976931348623157e+308, 0 ),
|
JS_PROP_DOUBLE_DEF("MAX_VALUE", 1.7976931348623157e+308, 0 ),
|
||||||
JS_PROP_DOUBLE_DEF("MIN_VALUE", 5e-324, 0 ),
|
JS_PROP_DOUBLE_DEF("MIN_VALUE", 5e-324, 0 ),
|
||||||
JS_PROP_DOUBLE_DEF("NaN", NAN, 0 ),
|
JS_PROP_U2D_DEF("NaN", 0x7FF8ull<<48, 0 ), // workaround for msvc
|
||||||
JS_PROP_DOUBLE_DEF("NEGATIVE_INFINITY", -INFINITY, 0 ),
|
JS_PROP_DOUBLE_DEF("NEGATIVE_INFINITY", -INFINITY, 0 ),
|
||||||
JS_PROP_DOUBLE_DEF("POSITIVE_INFINITY", INFINITY, 0 ),
|
JS_PROP_DOUBLE_DEF("POSITIVE_INFINITY", INFINITY, 0 ),
|
||||||
JS_PROP_DOUBLE_DEF("EPSILON", 2.220446049250313e-16, 0 ), /* ES6 */
|
JS_PROP_DOUBLE_DEF("EPSILON", 2.220446049250313e-16, 0 ), /* ES6 */
|
||||||
|
@ -50197,7 +50197,7 @@ static const JSCFunctionListEntry js_global_funcs[] = {
|
||||||
JS_CFUNC_DEF("escape", 1, js_global_escape ),
|
JS_CFUNC_DEF("escape", 1, js_global_escape ),
|
||||||
JS_CFUNC_DEF("unescape", 1, js_global_unescape ),
|
JS_CFUNC_DEF("unescape", 1, js_global_unescape ),
|
||||||
JS_PROP_DOUBLE_DEF("Infinity", 1.0 / 0.0, 0 ),
|
JS_PROP_DOUBLE_DEF("Infinity", 1.0 / 0.0, 0 ),
|
||||||
JS_PROP_DOUBLE_DEF("NaN", NAN, 0 ),
|
JS_PROP_U2D_DEF("NaN", 0x7FF8ull<<48, 0 ), // workaround for msvc
|
||||||
JS_PROP_UNDEFINED_DEF("undefined", 0 ),
|
JS_PROP_UNDEFINED_DEF("undefined", 0 ),
|
||||||
JS_PROP_STRING_DEF("[Symbol.toStringTag]", "global", JS_PROP_CONFIGURABLE ),
|
JS_PROP_STRING_DEF("[Symbol.toStringTag]", "global", JS_PROP_CONFIGURABLE ),
|
||||||
};
|
};
|
||||||
|
|
|
@ -970,6 +970,7 @@ typedef struct JSCFunctionListEntry {
|
||||||
const char *str; /* pure ASCII or UTF-8 encoded */
|
const char *str; /* pure ASCII or UTF-8 encoded */
|
||||||
int32_t i32;
|
int32_t i32;
|
||||||
int64_t i64;
|
int64_t i64;
|
||||||
|
uint64_t u64;
|
||||||
double f64;
|
double f64;
|
||||||
} u;
|
} u;
|
||||||
} JSCFunctionListEntry;
|
} JSCFunctionListEntry;
|
||||||
|
@ -998,6 +999,7 @@ typedef struct JSCFunctionListEntry {
|
||||||
#define JS_PROP_INT32_DEF(name, val, prop_flags) { name, prop_flags, JS_DEF_PROP_INT32, 0, { .i32 = val } }
|
#define JS_PROP_INT32_DEF(name, val, prop_flags) { name, prop_flags, JS_DEF_PROP_INT32, 0, { .i32 = val } }
|
||||||
#define JS_PROP_INT64_DEF(name, val, prop_flags) { name, prop_flags, JS_DEF_PROP_INT64, 0, { .i64 = val } }
|
#define JS_PROP_INT64_DEF(name, val, prop_flags) { name, prop_flags, JS_DEF_PROP_INT64, 0, { .i64 = val } }
|
||||||
#define JS_PROP_DOUBLE_DEF(name, val, prop_flags) { name, prop_flags, JS_DEF_PROP_DOUBLE, 0, { .f64 = val } }
|
#define JS_PROP_DOUBLE_DEF(name, val, prop_flags) { name, prop_flags, JS_DEF_PROP_DOUBLE, 0, { .f64 = val } }
|
||||||
|
#define JS_PROP_U2D_DEF(name, val, prop_flags) { name, prop_flags, JS_DEF_PROP_DOUBLE, 0, { .u64 = val } }
|
||||||
#define JS_PROP_UNDEFINED_DEF(name, prop_flags) { name, prop_flags, JS_DEF_PROP_UNDEFINED, 0, { .i32 = 0 } }
|
#define JS_PROP_UNDEFINED_DEF(name, prop_flags) { name, prop_flags, JS_DEF_PROP_UNDEFINED, 0, { .i32 = 0 } }
|
||||||
#define JS_OBJECT_DEF(name, tab, len, prop_flags) { name, prop_flags, JS_DEF_OBJECT, 0, { .prop_list = { tab, len } } }
|
#define JS_OBJECT_DEF(name, tab, len, prop_flags) { name, prop_flags, JS_DEF_OBJECT, 0, { .prop_list = { tab, len } } }
|
||||||
#define JS_ALIAS_DEF(name, from) { name, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE, JS_DEF_ALIAS, 0, { .alias = { from, -1 } } }
|
#define JS_ALIAS_DEF(name, from) { name, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE, JS_DEF_ALIAS, 0, { .alias = { from, -1 } } }
|
||||||
|
|
Loading…
Reference in a new issue