summaryrefslogtreecommitdiff
path: root/bignum.c
AgeCommit message (Collapse)Author
2013-08-03* bignum.c (big2str_orig): Receive the number to stringize asakr
BDIGIT array and size. (big2str_karatsuba): Receive the number to stringize as BDIGIT array and size. Use an temporary array of BDIGIT. (rb_big2str1): Follow the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-03* bignum.c (MAX_BASE36_POWER_TABLE_ENTRIES): Renamed fromakr
MAX_BIG2STR_TABLE_ENTRIES. (base36_power_cache): Renamed from big2str_power_cache. (base36_numdigits_cache): Renamed from big2str_numdigits_cache. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-02* bignum.c (big2str_orig): Refactored.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-02* bignum.c (big2str_orig): Rename a local variable.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-02* bignum.c (bigadd_core): Removed.akr
(bigadd): Use bary_add instead of bigadd_core. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-02* bignum.c (rb_big2str1): Simplify power_level calculation.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-02* bignum.c (power_cache_get_power): Appry bigtrunc to the result ofakr
bigsq. (big2str_karatsuba): Fix number of leading zero characters. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-02bignum.c: suppress a warningnobu
* bignum.c (rb_cstr_to_inum): remove set but unused variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-02* bignum.c (big2str_karatsuba): Reduce power_level more than one atakr
recursion, if possible. (rb_big2str1): Follow the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-02* bignum.c (bary_mul): Swap x and y for bary_mul1 if x is longer than y.akr
[ruby-dev:47565] [Bug #8719] Reported by Narihiro Nakamura. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-01* bignum.c (big2str_orig): Remove len argument.akr
(big2str_karatsuba): Ditto. (rb_big2str1): Follow above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-01* bignum.c (rb_big2str1): Remove a local variable.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-01* bignum.c (rb_cstr_to_inum): Use power_cache_get_power.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-01* bignum.c (rb_big2str1): Raise an error for too big number.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-01* bignum.c (power_cache_get_power): Hide cached Bignum objects.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-01* bignum.c (rb_big2str1): Remove non-trim mode.akr
(rb_big2str0): Non-trim mode implemented here. (big2str_find_n1): Change the result type to long again. (big2str_base_powerof2): Don't take arguments: len and trim. (rb_big2str): Follow above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-01* bignum.c (big2str_alloc): New function to allocate the result string. akr
It is called after actual length is calculated. (big2str_struct): Add fields: negative, result and ptr. (big2str_orig): Write out the result via b2s->ptr. (big2str_orig): Ditto. (rb_big2str1): Don't allocate the result string at beginning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-31* bignum.c (big2str_orig): Use temporary buffer when trim mode.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-31* bignum.c (big2str_orig): Simplified because RBIGNUM_LEN(x) <= 2 now.akr
(big2str_struct): Two fields added: hbase2, hbase2_numdigits. (rb_big2str1): Initialize above fields. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-31* bignum.c (big2str_karatsuba): Fix a condition of power_level.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-31* remove trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-31* bignum.c (LOG2_KARATSUBA_BIG2STR_DIGITS): Removed.akr
(KARATSUBA_BIG2STR_DIGITS): Removed. (big2str_numdigits_cache): New variable. (power_cache_get_power): Merged with power_cache_get_power0. This function returns maxpow_in_bdigit_dbl(base)**(2**power_level). (rb_big2str1): use power_cache_get_power. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-31* bignum.c (big2str_find_n1): Change the return type to size_t.akr
(big2str_orig): Ditto. (big2str_karatsuba): Ditto. (rb_big2str1): Follow the above changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-31* bignum.c (power_cache_get_power): Change numdigits_ret to size_t *.akr
(big2str_orig): Change len argument to size_t. (big2str_karatsuba): Ditto. (rb_big2str1): Follow the above changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-31* bignum.c (bary_cmp): Extracted from rb_big_cmp.akr
(power_cache_get_power): Change n1 argument (number of digits) to power_level which is just passed to power_cache_get_power0. (big2str_karatsuba): Ditto. (rb_big2str1): Calculate the initial power_level. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-31* bignum.c (MAX_BIG2STR_TABLE_ENTRIES): Use SIZEOF_SIZE_T.akr
(power_cache_get_power0): Add rb_bug call for too bit i argument. (power_cache_get_power): Simplified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-31* bignum.c (big2str_struct): New structure.akr
(big2str_orig): Use big2str_struct. (big2str_karatsuba): Ditto. (rb_big2str1): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-29* bignum.c (LOG2_KARATSUBA_BIG2STR_DIGITS): Renamed fromakr
LOG2_KARATSUBA_DIGITS. (KARATSUBA_BIG2STR_DIGITS): Renamed from KARATSUBA_DIGITS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-28* bignum.c (bigdivrem): Specialized implementation added forakr
nx == 2 && ny == 2 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-28* bignum.c (absint_numwords_generic): The char_bit variable changedakr
to a static constant. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-28* bignum.c: Constify bary_* functions.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-28* include/ruby/intern.h (rb_absint_size): Declaration moved fromakr
internal.h to calculate required buffer size to pack integers. (rb_absint_numwords): Ditto. (rb_absint_singlebit_p): Ditto. [ruby-core:42813] [Feature #6065] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-27* bignum.c (rb_big_size): Return the bignum "bytewise" size.akr
[ruby-core:55578] [Feature #8553] This is accepted by matz on DevelopersMeeting20130727Japan. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-23* bignum.c: Move functions.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-23* bignum.c (bary_divmod): Add special cases for x < y easily detectedakr
and nx == 2 && ny == 2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-22* bignum.c (bary_mulsub_1xN): New function.akr
(bary_mul_toom3): Use bary_mulsub_1xN. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-22* bignum.c (KARATSUBA_BALANCED): New macro.akr
(TOOM3_BALANCED): Ditto. (bary_mul_balance_with_mulfunc): Use KARATSUBA_BALANCED and TOOM3_BALANCED. (rb_big_mul_balance): Relax a condition. (rb_big_mul_karatsuba): Use KARATSUBA_BALANCED. (rb_big_mul_toom3): Use TOOM3_BALANCED. (bary_mul_karatsuba_branch): Use KARATSUBA_BALANCED. (bary_mul_toom3_branch): Use TOOM3_BALANCED. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-22* bignum.c (bigdivrem_mulsub): Extracted from bigdivrem1.akr
(bigdivrem1): Use bary_add. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-21* bignum.c (bary_sq_fast): Refine expressions.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-21* bignum.c (bary_mul): Use simple multiplication if yl is small.akr
(rb_cstr_to_inum): Invoke bigsq instead of bigmul0. (bigsq): Re-implemented. (bigmul0): Invoke bigsq if two arguments are identical. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-21* bignum.c (bary_mul_toom3): New function based on bigmul1_toom3.akr
(bary_mul_toom3_branch): Call bary_mul_toom3. (rb_big_mul_toom3): Ditto. (bigmul1_toom3): Removed. (big_real_len): Ditto. (big_split): Ditto. (big_split3): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-20Update a comment for Toom3.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-18* bignum.c (bary_sq_fast): Specialize the last iteration of theakr
outer loop. (bigfixize): A condition simplified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-18* bignum.c (BDIGITS_ZERO): Defined.akr
(bary_pack): Use BDIGITS_ZERO. (bary_unpack): Ditto. (bary_mul_single): Ditto. (bary_mul_normal): Ditto. (bary_sq_fast): Ditto. (bary_mul_balance_with_mulfunc): Ditto. (bary_mul_precheck): Ditto. (bary_mul_toom3_branch): Ditto. (rb_cstr_to_inum): Ditto. (big_shift3): Ditto. (bigmul1_toom3): Ditto. (bary_divmod): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-17* bignum.c: An static assertion for relation of SIZEOF_LONG andakr
SIZEOF_BDIGITS is added. (bary_mul_precheck): Reduce comparisons. (bary_mul): Invoke bary_sq_fast or bary_mul1 if the bignum size is small. (bigfixize): Resize the argument bignum here. (bignorm): Don't call bigtrunc after bigfixize. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16* bignum.c (bigmul1_toom3): Use bigdivrem_single instead of bigdivrem.akr
(big_three): Removed. (Init_Bignum): Don't initialize big_three. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16* bignum.c (bigsq): Renamed from bigsqr.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16* bignum.c (USHORT): Unused macro removed.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16* bignum.c (big_shift3): Big shift width is not a problem for rightakr
shift. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16* bignum.c (bary_mul_karatsuba): Avoid duplicate calculation whenakr
squaring. ((bary_mul_toom3_branch): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e