diff options
author | 卜部昌平 <[email protected]> | 2020-06-16 13:02:03 +0900 |
---|---|---|
committer | 卜部昌平 <[email protected]> | 2020-06-29 11:05:41 +0900 |
commit | cc27cd26d728d285aed728e730994d31f5ac1241 (patch) | |
tree | a4292c8a7eecc8a70f21ff06a6870c5da9f1280d /random.c | |
parent | 08202d1f0e120bc09431149e3fe2284f992dbb6d (diff) |
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.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3247
Diffstat (limited to 'random.c')
-rw-r--r-- | random.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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); |