You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Avoid RangeError on integers larger than LONG_LONG (brianmario#764)
CRuby's rb_big2ull raises RangeError if the argument is out of [LONG_MIN, ULONG_MAX].
To avoid that calling to_s and set as decimal with some tricks for edge cases.
For Ruby 1.8.7, use rb_funcall() to call Bignum#<=> through Ruby space.
For Ruby 1.9.3 and 2.0.0, use rb_big_cmp() to call Bignum#<=> directly.
For Ruby 2.1 and above, use rb_absint_size() and I noticed
len == 8 && nlz_bits == 0 && rb_absint_singlebit_p(bignum)
is the best condition because it doesn't allocate extra object.
0 commit comments