diff options
author | bellard <6490144+bellard@users.noreply.github.com> | 2020-09-06 18:57:11 +0200 |
---|---|---|
committer | bellard <6490144+bellard@users.noreply.github.com> | 2020-09-06 18:57:11 +0200 |
commit | 0e8fffd4de4a10f498f46cd0e99f53da6a523542 (patch) | |
tree | fc80c9b15e5816b84ae7d012a1106f7f46a70332 /quickjs.h | |
parent | 91459fb6723e29e923380cec0023af93819ae69d (diff) | |
download | quickjs-0e8fffd4de4a10f498f46cd0e99f53da6a523542.tar.gz quickjs-0e8fffd4de4a10f498f46cd0e99f53da6a523542.zip |
2020-01-19 release
Diffstat (limited to 'quickjs.h')
-rw-r--r-- | quickjs.h | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -53,7 +53,7 @@ typedef struct JSClass JSClass; typedef uint32_t JSClassID; typedef uint32_t JSAtom; -#if defined(__x86_64__) || defined(__aarch64__) +#if INTPTR_MAX >= INT64_MAX #define JS_PTR64 #define JS_PTR64_DEF(a) a #else @@ -366,7 +366,9 @@ void JS_AddIntrinsicPromise(JSContext *ctx); void JS_AddIntrinsicBigInt(JSContext *ctx); void JS_AddIntrinsicBigFloat(JSContext *ctx); void JS_AddIntrinsicBigDecimal(JSContext *ctx); -/* enable "use bigint", "use math" and operator overloading */ +/* enable operator overloading */ +void JS_AddIntrinsicOperators(JSContext *ctx); +/* enable "use math" */ void JS_EnableBignumExt(JSContext *ctx, JS_BOOL enable); JSValue js_string_codePointRange(JSContext *ctx, JSValueConst this_val, @@ -531,12 +533,16 @@ static js_force_inline JSValue JS_NewFloat64(JSContext *ctx, double d) return v; } -JS_BOOL JS_IsNumber(JSValueConst v); +static inline JS_BOOL JS_IsNumber(JSValueConst v) +{ + int tag = JS_VALUE_GET_TAG(v); + return tag == JS_TAG_INT || JS_TAG_IS_FLOAT64(tag); +} -static inline JS_BOOL JS_IsInteger(JSValueConst v) +static inline JS_BOOL JS_IsBigInt(JSContext *ctx, JSValueConst v) { int tag = JS_VALUE_GET_TAG(v); - return tag == JS_TAG_INT || tag == JS_TAG_BIG_INT; + return tag == JS_TAG_BIG_INT; } static inline JS_BOOL JS_IsBigFloat(JSValueConst v) |