Explicit cast in JS_NewInt64 & JS_NewUint32

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.
This commit is contained in:
Frère Jérôme 2024-06-03 11:22:19 +02:00 committed by Saúl Ibarra Corretgé
parent 1746ab8e28
commit c7bd41197a

View file

@ -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;
}
@ -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;
}