Skip to content

Commit 2f88a92

Browse files
committed
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.
1 parent e8accdb commit 2f88a92

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

include/ruby/internal/arithmetic/int.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ static inline VALUE
254254
rb_uint2num_inline(unsigned int v)
255255
{
256256
if (RB_POSFIXABLE(v))
257-
return RB_LONG2FIX(v);
257+
return RB_LONG2FIX(RBIMPL_CAST((long)v));
258258
else
259259
return rb_uint2big(v);
260260
}

include/ruby/internal/intern/select/win32.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ rb_fd_max(const rb_fdset_t *f)
253253
const fd_set *p = f->fdset;
254254

255255
RBIMPL_ASSERT_OR_ASSUME(p);
256-
return p->fd_count;
256+
return RBIMPL_CAST((int)p->fd_count);
257257
}
258258

259259
#endif /* RBIMPL_INTERN_SELECT_WIN32_H */

0 commit comments

Comments
 (0)