mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
rand_range: do not goto into a branch
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
This commit is contained in:
parent
08202d1f0e
commit
cc27cd26d7
Notes:
git
2020-06-29 11:06:53 +09:00
1 changed files with 1 additions and 1 deletions
2
random.c
2
random.c
|
@ -1169,8 +1169,8 @@ rand_range(VALUE obj, rb_random_t* rnd, VALUE range)
|
|||
long max;
|
||||
vmax = v;
|
||||
v = Qnil;
|
||||
fixnum:
|
||||
if (FIXNUM_P(vmax)) {
|
||||
fixnum:
|
||||
if ((max = FIX2LONG(vmax) - excl) >= 0) {
|
||||
unsigned long r = random_ulong_limited(obj, rnd, (unsigned long)max);
|
||||
v = ULONG2NUM(r);
|
||||
|
|
Loading…
Reference in a new issue