Fix sign-conversion warnings on IL32 platforms

If `long` and `int` are the same size, `unsigned int` max would exceed
`signed long` range.  It is guaranteed by `RB_POSFIXABLE` that `v` can
be casted to `long` safely here.
This commit is contained in:
Nobuyoshi Nakada 2024-11-10 21:57:56 +09:00
parent e8accdb22e
commit 2f88a9258d
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2024-11-10 13:51:20 +00:00
2 changed files with 2 additions and 2 deletions

View File

@ -254,7 +254,7 @@ static inline VALUE
rb_uint2num_inline(unsigned int v)
{
if (RB_POSFIXABLE(v))
return RB_LONG2FIX(v);
return RB_LONG2FIX(RBIMPL_CAST((long)v));
else
return rb_uint2big(v);
}

View File

@ -253,7 +253,7 @@ rb_fd_max(const rb_fdset_t *f)
const fd_set *p = f->fdset;
RBIMPL_ASSERT_OR_ASSUME(p);
return p->fd_count;
return RBIMPL_CAST((int)p->fd_count);
}
#endif /* RBIMPL_INTERN_SELECT_WIN32_H */