akr
ccdc9ecf64
* ext/-test-/bignum/intpack.c: Renamed from ext/-test-/bignum/pack.c.
...
(Init_intpack): Renamed from Init_pack.
Reported by Naohisa Goto. [ruby-dev:47526] [Bug #8655 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-18 16:07:03 +00:00
akr
6fdad008a2
* bignum.c (rb_big_sq_fast): New function for testing.
...
(rb_big_mul_toom3): Ditto.
* internal.h (rb_big_sq_fast): Declared.
(rb_big_mul_toom3): Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-08 13:05:57 +00:00
akr
29634bca31
* internal.h (rb_big_mul_normal): Declared.
...
(rb_big_mul_balance): Ditto.
(rb_big_mul_karatsuba): Ditto.
* bignum.c (rb_big_mul_normal): New function for tests.
(rb_big_mul_balance): Ditto.
(rb_big_mul_karatsuba): Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-07 14:01:40 +00:00
akr
7251c93cb3
* bignum.c (RBIGNUM_SET_NEGATIVE_SIGN): New macro.
...
(RBIGNUM_SET_POSITIVE_SIGN): Ditto.
(rb_big_neg): Inline get2comp to avoid double negation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-29 15:57:07 +00:00
akr
8f0c3ff6e4
* bignum.c (bary_pack): Support
...
INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION flag.
Fix byte order and word order handling in code specialized for
wordsize % SIZEOF_BDIGITS == 0.
* internal.h (INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION): Defined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22 09:55:27 +00:00
akr
50794b3222
* bignum.c (bary_2comp): Extracted from get2comp.
...
(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 12:59:26 +00:00
akr
ecabbf1bf6
* internal.h (INTEGER_PACK_2COMP): Defined.
...
(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 09:53:45 +00:00
akr
aaa1461d7b
* bignum.c (rb_integer_unpack_2comp): New function.
...
(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 15:18:00 +00:00
akr
0c9a719d77
* internal.h (INTEGER_PACK_NEGATIVE): Defined.
...
(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 21:39:55 +00:00
akr
17a5321c40
rb_integer_pack tests refined.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-11 13:15:56 +00:00
akr
d5a3818f8e
* bignum.c (rb_integer_pack_internal): Renamed from rb_integer_pack
...
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-11 12:06:40 +00:00
akr
0e8caa7d0f
* bignum.c (rb_integer_pack): Returns sign instead of words.
...
(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 10:37:39 +00:00
akr
837392b452
* bignum.c (rb_integer_pack): numwords_allocated argument removed.
...
* internal.h (rb_integer_pack): Follow the above change.
* hash.c (rb_hash): Ditto.
* time.c (v2w_bignum): Ditto.
* pack.c (pack_pack): Ditto.
* random.c (int_pair_to_real_inclusive): Ditto.
(rand_init): Ditto.
(random_load): Ditto.
(limited_big_rand): Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-09 05:53:00 +00:00
akr
f31aed6255
* bignum.c (rb_integer_pack): Arguments changed. Use flags to
...
specify word order and byte order.
(rb_integer_unpack): Ditto.
(validate_integer_format): Follow the above change.
(integer_format_loop_setup): Ditto.
* pack.c: Ditto.
* internal.h: Ditto.
(INTEGER_PACK_MSWORD_FIRST): Defined.
(INTEGER_PACK_LSWORD_FIRST): Ditto.
(INTEGER_PACK_MSBYTE_FIRST): Ditto.
(INTEGER_PACK_LSBYTE_FIRST): Ditto.
(INTEGER_PACK_NATIVE_BYTE_ORDER): Ditto.
(INTEGER_PACK_LITTLE_ENDIAN): Ditto.
(INTEGER_PACK_BIG_ENDIAN): Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 15:02:39 +00:00
akr
a08b001100
* bignum.c (rb_integer_pack): Renamed from rb_int_export.
...
(rb_integer_unpack): Renamed from rb_int_import.
* internal.h, pack.c: Follow the above change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 12:41:02 +00:00
nobu
147775ac2b
use NUM2SIZET and SIZET2NUM
...
* configure.in: revert r41106. size_t may not be unsigned
* bignum.c (rb_absint_size_in_word, rb_int_export, rb_int_import): use
NUM2SIZET() and SIZET2NUM() already defined in ruby/ruby.h.
* ext/-test-/bignum/export.c (rb_int_export_m): ditto.
* ext/-test-/bignum/import.c (rb_int_import_m): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 02:41:45 +00:00
akr
d1f3d41f11
* internal.h (rb_int_export): countp argument is split into
...
wordcount_allocated and wordcount.
* bignum.c (rb_int_export): Follow the above change.
* pack.c (pack_pack): Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-06 22:31:23 +00:00
akr
c9c67d2fe0
* bignum.c (rb_int_import): New function.
...
(int_import_push_bits): Ditto.
* internal.h (rb_int_import): Declared.
* pack.c (pack_unpack): Use rb_int_import for BER compressed integer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-06 21:20:04 +00:00
akr
58eac2494f
Specify dependencies.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-06 12:58:25 +00:00
akr
9fea8758e9
* configure.in: Invoke RUBY_REPLACE_TYPE for size_t.
...
Don't invoke RUBY_CHECK_PRINTF_PREFIX for size_t to avoid conflict
with RUBY_REPLACE_TYPE.
* internal.h (rb_absint_size): Declared.
(rb_absint_size_in_word): Ditto.
(rb_int_export): Ditto.
* bignum.c (rb_absint_size): New function.
(rb_absint_size_in_word): Ditto.
(int_export_fill_dd): Ditto.
(int_export_take_lowbits): Ditto.
(rb_int_export): Ditto.
* pack.c (pack_pack): Use rb_int_export for BER compressed integer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-06 11:57:35 +00:00
nobu
b30a6b8d1d
bignum.c: Bignum zero comparison
...
* bignum.c (rb_big_eq): test as Fixnum if possible and get rid of zero
length Bignum. [ruby-core:53893] [Bug #8204 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-03 07:34:31 +00:00