summaryrefslogtreecommitdiff
path: root/bignum.c
AgeCommit message (Collapse)Author
2013-06-22* bignum.c (bary_pack): MEMZERO can be used even if nails is not zero.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22* bignum.c (CLEAR_LOWBITS): Rewritten without RSHIFTX.akr
(RSHIFTX): Removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22* bignum.c (LSHIFTX): Defined to suppress a warning.akr
(RSHIFTX): Ditto. (CLEAR_LOWBITS): Use LSHIFTX and RSHIFTX. (FILL_LOWBITS): Use LSHIFTX. Reported by ko1 via IRC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* bignum.c (bary_pack): Specialized packers implemented.akr
(HOST_BIGENDIAN_P): New macro. (ALIGNOF): New macro. (CLEAR_LOWBITS): New macro. (FILL_LOWBITS): New macro. (swap_bdigit): New macro. (bary_2comp): Returns an int. * internal.h (swap16): Moved from pack.c (swap32): Ditto. (swap64): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* bignum.c (BDIGMAX): Use BIGRAD.akr
(BIGLO): Use BDIGMAX. (bigdivrem1): Ditto. (bigor_int): Ditto. (rb_big_or): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* bignum.c (bigsub_int): Use bdigit_roomof.akr
(bigadd_int): Ditto. (bigand_int): Ditto. (bigor_int): Ditto. (bigxor_int): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-20* bignum.c (rb_ull2big): Refactored.akr
(rb_uint2big): Useless code removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-20* bignum.c (bigmul1_toom3): Don't call bignorm twice.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-20* bignum.c (bignorm): Don't call bigtrunc if the result is a fixnum.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-20* bignum.c (rb_uint2big): Refactored.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-20* bignum.c (dump_bignum): Use SIZEOF_BDIGITS.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-20An extra semicolon removed.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-20* bignum.c (big2ulong): Change the return type to unsigned long.akr
(rb_big2ulong_pack): Follow the above change. (rb_big2long): Ditto. (rb_big_lshift): Ditto. (rb_big_rshift): Ditto. (rb_big_aref): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-20* bignum.c (bary_unpack_internal): Return -2 when negative overflow.akr
(bary_unpack): Set the overflowed bit if an extra BDIGIT exists. (rb_integer_unpack): Set the overflowed bit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-19* bignum.c (BIGSIZE): New macro.akr
(bigfixize): Use BIGSIZE. (big2ulong): Ditto. (check_shiftdown): Ditto. (rb_big_aref): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-19* bignum.c (bdigit_roomof): Use SIZEOF_BDIGITS.akr
(bigfixize): Refine an ifdef condition. (rb_absint_size): Use bdigit_roomof. (rb_absint_singlebit_p): Ditto. (rb_integer_pack): Ditto. (integer_pack_fill_dd): Use BITSPERDIG. (integer_unpack_push_bits): Use BITSPERDIG, BIGLO and BIGDN. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-19* bignum.c (bigfixize): Use rb_absint_size.akr
(check_shiftdown): Ditto. (big2ulong): Use bdigit_roomof. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-19* bignum.c (rb_uint2big): Consider environments BDIGIT is bigger thanakr
long. (big2ulong): Ditto. (rb_big_aref): Ditto. (rb_big_pack): Just call rb_integer_pack. (rb_big_unpack): Just call rb_integer_unpack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-19* bignum.c (DIGSPERLONG): Don't define if BDIGIT is bigger than long.akr
(DIGSPERLL): Don't define if BDIGIT is bigger than LONG_LONG (rb_absint_size): Consider environments BDIGIT is bigger than long. Use BIGLO and BIGDN. (rb_absint_singlebit_p): Ditto. (rb_integer_pack): Ditto. (bigsub_int): Consider environments BDIGIT is bigger than long. Use SIZEOF_BDIGITS instead of sizeof(BDIGIT). (bigadd_int): Ditto. (bigand_int): Ditto. (bigor_int): Ditto. (bigxor_int): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-18* bignum.c (rb_big_aref): Apply BIGLO to ~xds[i] for environment whichakr
BDIGIT is 16bit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-18* configure.in: Check __int128.akr
* include/ruby/defines.h (BDIGIT_DBL): Use uint128_t if it is available. (BDIGIT): Use uint64_t if uint128_t is available. (SIZEOF_BDIGITS): Defined for above case. (BDIGIT_DBL_SIGNED): Ditto. (PRI_BDIGIT_PREFIX): Ditto. * include/ruby/ruby.h (PRI_64_PREFIX): Defined. * bignum.c (rb_big_pow): Don't use BITSPERDIG for the condition which rb_big_pow returns Float or Bignum. [ruby-dev:47413] [Feature #8509] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-18* bignum.c (nlz): Cast the result explicitly.akr
(big2dbl): Don't assign BDIGIT values to int variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-18* bignum.c (rb_big_xor): Non-effective code removed.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-16* bignum.c (bary_small_lshift): Renamed from bdigs_small_lshift.akr
(bary_small_rshift): Renamed from bdigs_small_rshift. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-16* bignum.c (absint_numwords_bytes): Removed.akr
(rb_absint_numwords): Don't call absint_numwords_bytes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-16* bignum.c (BARY_ADD): New macro.akr
(BARY_SUB): Ditto. (BARY_MUL): Ditto. (BARY_DIVMOD): Ditto. (BARY_ZERO_P): Ditto. (absint_numwords_generic): Use these macros. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-16* bignum.c (bary_2comp): Extracted from get2comp.akr
(integer_unpack_num_bdigits): Extracted from rb_integer_unpack_internal. (bary_unpack_internal): Renamed from bary_unpack and support INTEGER_PACK_2COMP. (bary_unpack): New function to validate arguments and invoke bary_unpack_internal. (rb_integer_unpack_internal): Removed. (rb_integer_unpack): Invoke bary_unpack_internal. (rb_integer_unpack_2comp): Removed. * internal.h (rb_integer_unpack_2comp): Removed. * pack.c: Follow the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-16* internal.h (INTEGER_PACK_2COMP): Defined.akr
(rb_integer_pack_2comp): Removed. * bignum.c (bary_pack): Support INTEGER_PACK_2COMP. (rb_integer_pack): Invoke bary_pack directly. (rb_integer_pack_2comp): Removed. (rb_integer_pack_internal): Ditto. (absint_numwords_generic): Follow the above change. * pack.c (pack_pack): Ditto. * sprintf.c (rb_str_format): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-16* bignum.c (absint_numwords_generic): rb_funcall invocations removed.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-16* bignum.c (bary_pack) Extracted from rb_integer_pack_internal.akr
(absint_numwords_generic): Use bary_pack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-16* bignum.c (bary_add): New function.akr
(bary_zero_p): Extracted from bigzero_p. (absint_numwords_generic): Use bary_zero_p and bary_add. (bary_mul): Fix an argument for bary_mul_single. (bary_divmod): Use size_t for arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-15* bignum.c (bigdivrem): Use a BDIGIT variable to store the returnakr
value of bigdivrem_single. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-15* bignum.c (bary_divmod): New function.akr
(absint_numwords_generic): Use bary_divmod. (bigdivrem_num_extra_words): Extracted from bigdivrem. (bigdivrem_single): Ditto. (bigdivrem_normal): Ditto. (BIGDIVREM_EXTRA_WORDS): Defined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-15* bignum.c (bary_sub): New function.akr
(absint_numwords_generic): Use bary_sub. (bigsub_core): Skip unnecessary copy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-15* bignum.c (bary_mul): New function.akr
(absint_numwords_generic): Use bary_mul. (bary_mul_single): Extracted from bigmul1_single. (bary_mul_normal): Extracted from bigmul1_normal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-15* bignum.c (bary_unpack): Extracted from rb_integer_unpack_internal.akr
(absint_numwords_generic): Use bary_unpack. (roomof): Defined. (bdigit_roomof): Defined. (BARY_ARGS): Defined. (bary_unpack): Declared. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-15* bignum.c (absint_numwords_bytes): Make it static.akr
(absint_numwords_small): Ditto. (absint_numwords_generic): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-15* bignum.c (bigmul1_normal): Shrink the result Bignum length.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-15* bignum.c (bdigs_small_rshift): Extracted from big_rshift.akr
(bigdivrem): Use bdigs_small_rshift. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-14* bignum.c (bdigs_small_lshift): Extracted from big_lshift.akr
(bigdivrem): Use bdigs_small_lshift. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-14* bignum.c (bigdivrem): Reduce number of digits before bignew() for div.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-14* bignum.c (bigdivrem): Use bignew when ny == 1.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-13* bignum.c (bigdivrem): Zero test condition simplified.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-13Use ny instead of RBIGNUM_LEN(y).akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-13* bignum.c (bigdivrem): Refactored to use ALLOCV_N for temporallyakr
buffers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-13* bignum.c (integer_unpack_num_bdigits_generic): reorder terms (but notusa
changed the intention of the expression) because VC++ reports a warning for it. reported by ko1 via IRC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-13* bignum.c (bigdivrem): Use nlz.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-13bignum.c: suppress warningsnobu
* bignum.c (integer_unpack_num_bdigits_generic): suppress "implicit conversion shortens 64-bit value into a 32-bit value" warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-13Refine debug code.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12* bignum.c (integer_unpack_num_bdigits_small): Fix a comple error onakr
clang -Werror,-Wshorten-64-to-32 Reported by Eric Hodel. [ruby-core:55467] [Bug #8522] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e