Skip to content

Commit

Permalink
Patch quickjs.c to work around an error in Clang
Browse files Browse the repository at this point in the history
    error: implicit conversion from 'long long' to 'double' changes
           value from 9223372036854775807 to 9223372036854775808
           [-Werror,-Wimplicit-const-int-float-conversion]
                    else if (d > INT64_MAX)
                               ~ ^~~~~~~~~
  • Loading branch information
squarejesse committed Nov 2, 2023
1 parent 3616a21 commit 0cf55d9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions zipline/native/quickjs/quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
#define CONFIG_STACK_CHECK
#endif

/* Zipline-patched for https://github.com/bellard/quickjs/pull/196 */
static double const INT64_MAX_PLUS_ONE_AS_DOUBLE = 9223372036854775808.0;

/* dump object free */
//#define DUMP_FREE
Expand Down Expand Up @@ -10738,7 +10740,7 @@ static int JS_ToInt64SatFree(JSContext *ctx, int64_t *pres, JSValue val)
} else {
if (d < INT64_MIN)
*pres = INT64_MIN;
else if (d > INT64_MAX)
else if (d >= INT64_MAX_PLUS_ONE_AS_DOUBLE)
*pres = INT64_MAX;
else
*pres = (int64_t)d;
Expand Down Expand Up @@ -53819,7 +53821,7 @@ static JSValue js_atomics_wait(JSContext *ctx,
}
if (JS_ToFloat64(ctx, &d, argv[3]))
return JS_EXCEPTION;
if (isnan(d) || d > INT64_MAX)
if (isnan(d) || d >= INT64_MAX_PLUS_ONE_AS_DOUBLE)
timeout = INT64_MAX;
else if (d < 0)
timeout = 0;
Expand Down

0 comments on commit 0cf55d9

Please sign in to comment.