summaryrefslogtreecommitdiff
path: root/bignum.c
AgeCommit message (Collapse)Author
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
2013-06-12* bignum.c (rb_integer_unpack_2comp): New function.akr
(rb_integer_unpack_internal): Extracted from rb_integer_unpack and nlp_bits_ret argument added. (integer_unpack_num_bdigits_small): nlp_bits_ret argument added to return number of leading padding bits. (integer_unpack_num_bdigits_generic): Ditto. * internal.h (rb_integer_unpack_2comp): Declared. * pack.c (pack_unpack): Use rb_integer_unpack_2comp and rb_integer_unpack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12* bignum.c (integer_unpack_num_bdigits_generic): Rewritten withoutakr
rb_funcall. (integer_unpack_num_bdigits_bytes): Removed. (rb_integer_unpack): integer_unpack_num_bdigits_bytes invocation removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12* bignum.c (validate_integer_pack_format): supported_flags argumentakr
added and validate given flags. (rb_integer_pack_internal): Specify supported_flags. (rb_integer_unpack): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-11* internal.h (INTEGER_PACK_NEGATIVE): Defined.akr
(rb_integer_unpack): sign argument removed. * bignum.c (rb_integer_unpack): sign argument removed. Non-negative integers generated by default. INTEGER_PACK_NEGATIVE flag is used to generate non-positive integers. * pack.c (pack_unpack): Follow the above change. * random.c (int_pair_to_real_inclusive): Ditto. (make_seed_value): Ditto. (mt_state): Ditto. (limited_big_rand): Ditto. * marshal.c (r_object0): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-11* bignum.c (validate_integer_pack_format): Don't require a word orderakr
flag if numwords is 1 or less. (absint_numwords_generic): Don't specify a word order for rb_integer_pack. * hash.c (rb_hash): Ditto. * time.c (v2w_bignum): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-11* bignum.c (validate_integer_pack_format): Refine error messages.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-11* bignum.c (validate_integer_pack_format): numwords argument added.akr
Move a varidation from rb_integer_pack_internal and rb_integer_unpack. (rb_integer_pack_internal): Follow above change. (rb_integer_unpack): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-11* bignum.c (rb_integer_pack_internal): Renamed from rb_integer_packakr
and overflow_2comp argument added. (rb_integer_pack): Just call rb_integer_pack_internal. (rb_integer_pack_2comp): New function. * internal.h (rb_integer_pack_2comp): Declared. * sprintf.c (rb_str_format): Use rb_integer_pack and rb_integer_pack_2comp to format binary/octal/hexadecimal integers. (ruby_digitmap): Declared. (remove_sign_bits): Removed. (BITSPERDIG): Ditto. (EXTENDSIGN): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-10Update comment.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-10Update a comment.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-10Update doc.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-10* bignum.c (rb_integer_pack): Returns sign instead of words.akr
(absint_numwords_generic): Follow the above change. (big2str_base_powerof2): Follow the above change. * internal.h: Ditto. * hash.c (rb_hash): Ditto. * pack.c (pack_pack): Ditto. * random.c (int_pair_to_real_inclusive): Ditto. (rand_init): Ditto. (random_load): Ditto. (limited_big_rand): Ditto. * time.c (v2w_bignum): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-10* bignum.c (integer_unpack_num_bdigits_small: Extracted fromakr
rb_integer_unpack. (integer_unpack_num_bdigits_generic): Ditto. (integer_unpack_num_bdigits_bytes): New function. (rb_integer_unpack): Use above functions. Return a Bignum for INTEGER_PACK_FORCE_BIGNUM evenwhen the result is zero. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-09* bignum.c (absint_numwords_small): New function.akr
(absint_numwords_generic): Use absint_numwords_small if possible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e