aboutsummaryrefslogtreecommitdiffstats
path: root/bignum.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-11 13:18:22 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-29 11:05:41 +0900
commit9ec4f1f205f7106e7b2e82abd69dbbc58978c586 (patch)
tree3cc9b6d67b8e22b95b947faf07e04dad2147140c /bignum.c
parent184f0ab4c9e56e338de5b6fa7115c38406a184d4 (diff)
downloadruby-9ec4f1f205f7106e7b2e82abd69dbbc58978c586.tar.gz
rb_big_aref: 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.
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bignum.c b/bignum.c
index 43eb939e14..310e731934 100644
--- a/bignum.c
+++ b/bignum.c
@@ -6712,7 +6712,6 @@ rb_big_aref(VALUE x, VALUE y)
return INT2FIX(0);
bigtrunc(y);
if (BIGSIZE(y) > sizeof(size_t)) {
- out_of_range:
return BIGNUM_SIGN(x) ? INT2FIX(0) : INT2FIX(1);
}
#if SIZEOF_SIZE_T <= SIZEOF_LONG
@@ -6730,7 +6729,8 @@ rb_big_aref(VALUE x, VALUE y)
s2 = shift%BITSPERDIG;
bit = (BDIGIT)1 << s2;
- if (s1 >= BIGNUM_LEN(x)) goto out_of_range;
+ if (s1 >= BIGNUM_LEN(x))
+ return BIGNUM_SIGN(x) ? INT2FIX(0) : INT2FIX(1);
xds = BDIGITS(x);
if (BIGNUM_POSITIVE_P(x))