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:
parent
1746ab8e28
commit
c7bd41197a
1 changed files with 4 additions and 4 deletions
|
@ -501,9 +501,9 @@ static js_force_inline JSValue JS_NewInt64(JSContext *ctx, int64_t val)
|
||||||
{
|
{
|
||||||
JSValue v;
|
JSValue v;
|
||||||
if (val >= INT32_MIN && val <= INT32_MAX) {
|
if (val >= INT32_MIN && val <= INT32_MAX) {
|
||||||
v = JS_NewInt32(ctx, val);
|
v = JS_NewInt32(ctx, (int32_t)val);
|
||||||
} else {
|
} else {
|
||||||
v = JS_NewFloat64(ctx, val);
|
v = JS_NewFloat64(ctx, (double)val);
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
@ -512,9 +512,9 @@ static js_force_inline JSValue JS_NewUint32(JSContext *ctx, uint32_t val)
|
||||||
{
|
{
|
||||||
JSValue v;
|
JSValue v;
|
||||||
if (val <= 0x7fffffff) {
|
if (val <= 0x7fffffff) {
|
||||||
v = JS_NewInt32(ctx, val);
|
v = JS_NewInt32(ctx, (int32_t)val);
|
||||||
} else {
|
} else {
|
||||||
v = JS_NewFloat64(ctx, val);
|
v = JS_NewFloat64(ctx, (double)val);
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue