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.
This commit is contained in:
parent
184f0ab4c9
commit
9ec4f1f205
Notes:
git
2020-06-29 11:07:15 +09:00
4
bignum.c
4
bignum.c
@ -6712,7 +6712,6 @@ rb_big_aref(VALUE x, VALUE y)
|
|||||||
return INT2FIX(0);
|
return INT2FIX(0);
|
||||||
bigtrunc(y);
|
bigtrunc(y);
|
||||||
if (BIGSIZE(y) > sizeof(size_t)) {
|
if (BIGSIZE(y) > sizeof(size_t)) {
|
||||||
out_of_range:
|
|
||||||
return BIGNUM_SIGN(x) ? INT2FIX(0) : INT2FIX(1);
|
return BIGNUM_SIGN(x) ? INT2FIX(0) : INT2FIX(1);
|
||||||
}
|
}
|
||||||
#if SIZEOF_SIZE_T <= SIZEOF_LONG
|
#if SIZEOF_SIZE_T <= SIZEOF_LONG
|
||||||
@ -6730,7 +6729,8 @@ rb_big_aref(VALUE x, VALUE y)
|
|||||||
s2 = shift%BITSPERDIG;
|
s2 = shift%BITSPERDIG;
|
||||||
bit = (BDIGIT)1 << s2;
|
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);
|
xds = BDIGITS(x);
|
||||||
if (BIGNUM_POSITIVE_P(x))
|
if (BIGNUM_POSITIVE_P(x))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user