Skip to content

Commit

Permalink
Explicit cast in JS_NewInt64 & JS_NewUint32
Browse files Browse the repository at this point in the history
This avoids the two GCC -Wconversion warnings in this public header, which is useful when using extensive error reporting from the compiler, and treating warnings as errors.
  • Loading branch information
frerejerome authored and saghul committed Jun 3, 2024
1 parent 1746ab8 commit c7bd411
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions quickjs.h
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,9 @@ static js_force_inline JSValue JS_NewInt64(JSContext *ctx, int64_t val)
{
JSValue v;
if (val >= INT32_MIN && val <= INT32_MAX) {
v = JS_NewInt32(ctx, val);
v = JS_NewInt32(ctx, (int32_t)val);
} else {
v = JS_NewFloat64(ctx, val);
v = JS_NewFloat64(ctx, (double)val);
}
return v;
}
Expand All @@ -512,9 +512,9 @@ static js_force_inline JSValue JS_NewUint32(JSContext *ctx, uint32_t val)
{
JSValue v;
if (val <= 0x7fffffff) {
v = JS_NewInt32(ctx, val);
v = JS_NewInt32(ctx, (int32_t)val);
} else {
v = JS_NewFloat64(ctx, val);
v = JS_NewFloat64(ctx, (double)val);
}
return v;
}
Expand Down

0 comments on commit c7bd411

Please sign in to comment.