1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

thread.c: unsigned

* thread.c (rb_thread_shield_waiting_{inc,dec}): should be unsigned.
  int is large enough since ruby requires it to be 32bit at least.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-07-06 03:46:39 +00:00
parent 1474cfa846
commit 8a995a56c7

View file

@ -3727,9 +3727,9 @@ thread_shield_alloc(VALUE klass)
static inline void
rb_thread_shield_waiting_inc(VALUE b)
{
int w = rb_thread_shield_waiting(b);
unsigned int w = rb_thread_shield_waiting(b);
w++;
if (w > (THREAD_SHIELD_WAITING_MASK>>THREAD_SHIELD_WAITING_SHIFT))
if (w > (unsigned int)(THREAD_SHIELD_WAITING_MASK>>THREAD_SHIELD_WAITING_SHIFT))
rb_raise(rb_eRuntimeError, "waiting count overflow");
RBASIC(b)->flags &= ~THREAD_SHIELD_WAITING_MASK;
RBASIC(b)->flags |= ((VALUE)w << THREAD_SHIELD_WAITING_SHIFT);
@ -3738,7 +3738,7 @@ rb_thread_shield_waiting_inc(VALUE b)
static inline void
rb_thread_shield_waiting_dec(VALUE b)
{
int w = rb_thread_shield_waiting(b);
unsigned int w = rb_thread_shield_waiting(b);
if (!w) rb_raise(rb_eRuntimeError, "waiting count underflow");
w--;
RBASIC(b)->flags &= ~THREAD_SHIELD_WAITING_MASK;