marcandre
ea7a3644d3
* enum.c: [DOC] Improve doc [ci-skip]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-06 04:35:26 +00:00
hsbt
364a0879c9
* enum.c: Add reduce/inject alias note.
...
[fix GH-1400][ci skip] Patch by @getaaron
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-06 01:53:17 +00:00
marcandre
69846644d2
* enum.c: Make Enumerable#chunk with no block return
...
an Enumerator [#2172 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-04 18:25:16 +00:00
nobu
0cc169d1de
fid typos [ci skip]
...
* fix typos, "a" before "Integer" to "an". [Fix GH-1438]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-24 02:28:25 +00:00
mrkn
d661b27784
enum.c (enum_sort): prevent wasteful array duplicaion
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-20 20:51:19 +00:00
nobu
e9f61faa4b
enum.c: [DOC] Enumerable#uniq [ci skip]
...
* enum.c (enum_uniq): add rdoc, reference to Array#uniq.
[Feature #11090 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-20 21:15:19 +00:00
nobu
42c6a5137e
enum.c: Enumerable#uniq
...
* enum.c (enum_uniq): new method Enumerable#uniq.
[Feature #11090 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-20 08:39:12 +00:00
nobu
b7733bf6c5
exclude non-VALUE in memo from GC
...
* internal.h (NEW_PARTIAL_MEMO_FOR): shrink buffer array not to
mark non-VALUE fields. fix check_rvalue_consistency abort with
RGENGC_CHECK_MODE=2.
* internal.h (NEW_CMP_OPT_MEMO): exclude struct cmp_opt_data from
the valid array range.
* enum.c (slicewhen_i): exclude inverted too.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-20 10:48:51 +00:00
nobu
abe32a00b1
enum.c: fix declaration-after-statement
...
* enum.c (sum_iter): workaround of mixed declarations and code.
erred by -Werror=declaration-after-statement option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 01:16:50 +00:00
mrkn
49432957c7
Optimize each_sum for hashes
...
* enum.c (enum_sum, hash_sum, hash_sum_i, enum_sum_i, sum_iter):
Optimize for hashes when each method isn't redefined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 00:54:52 +00:00
mrkn
eb9c9964b0
Extract int_range_sum from enum_sum
...
* enum.c (enum_sum, int_range_sum): Extract int_range_sum from
enum_sum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 00:16:06 +00:00
mrkn
d5595a9627
Optimize enum_sum for a range from int to int
...
* enum.c (enum_sum): Optimize for a range from int to int.
* test/ruby/test_enum.rb (test_range_sum): Move from test_range.rb,
and add assertions for some conditions.
* test/ruby/test_enum.rb (test_hash_sum): Move from test_hash.rb.
* test/ruby/test_hash.rb, test/ruby/test_range.rb: Remove test_sum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17 15:08:33 +00:00
mrkn
41d002bbad
Write document of Enumerable#sum
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17 14:09:37 +00:00
mrkn
41ef7ec381
Implement Enumerable#sum
...
* enum.c (enum_sum): Implement Enumerable#sum.
* test/ruby/test_enum.rb (test_sum): Test sum for Enumerable.
* test/ruby/test_hash.rb (test_sum): Test sum for Hash.
* test/ruby/test_range.rb (test_sum): Test sum for Range.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17 13:58:46 +00:00
akr
449fbfd4d4
Use Integer instead of Fixnum and Bignum.
...
* object.c, numeric.c, enum.c, ext/-test-/bignum/mul.c,
lib/rexml/quickpath.rb, lib/rexml/text.rb, lib/rexml/xpath_parser.rb,
lib/rubygems/specification.rb, lib/uri/generic.rb,
bootstraptest/test_eval.rb, basictest/test.rb,
test/-ext-/bignum/test_big2str.rb, test/-ext-/bignum/test_div.rb,
test/-ext-/bignum/test_mul.rb, test/-ext-/bignum/test_str2big.rb,
test/csv/test_data_converters.rb, test/date/test_date.rb,
test/json/test_json_generate.rb, test/minitest/test_minitest_mock.rb,
test/openssl/test_cipher.rb, test/rexml/test_jaxen.rb,
test/ruby/test_array.rb, test/ruby/test_basicinstructions.rb,
test/ruby/test_bignum.rb, test/ruby/test_case.rb,
test/ruby/test_class.rb, test/ruby/test_complex.rb,
test/ruby/test_enum.rb, test/ruby/test_eval.rb,
test/ruby/test_iseq.rb, test/ruby/test_literal.rb,
test/ruby/test_math.rb, test/ruby/test_module.rb,
test/ruby/test_numeric.rb, test/ruby/test_range.rb,
test/ruby/test_rational.rb, test/ruby/test_refinement.rb,
test/ruby/test_rubyvm.rb, test/ruby/test_struct.rb,
test/ruby/test_variable.rb, test/rubygems/test_gem_specification.rb,
test/thread/test_queue.rb: Use Integer instead of Fixnum and Bignum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17 13:15:57 +00:00
nobu
0c13d23d08
enum.c: examples of Enumerable#detect [ci skip]
...
* enum.c (enum_find): [DOC] add more examples to the documentation
of Enumerable#detect, to show that it equals to Enumerable#find.
[Fix GH-1340]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-05 23:16:28 +00:00
akr
b359d20352
* array.c (rb_ary_sum): Array#sum is implemented.
...
Kahan's compensated summation algorithm for precise sum of float
numbers is moved from ary_inject_op in enum.c.
* enum.c (ary_inject_op): Don't specialize for float numbers.
[ruby-core:74569] [Feature#12217] proposed by mrkn.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-13 13:51:53 +00:00
mrkn
aeb0be6ad5
* enum.c (ary_inject_op): put subtract operation out of if-clause.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-23 12:50:24 +00:00
mrkn
e324d29e2b
* enum.c (ary_inject_op): Use Kahan's compensated summation algorithm
...
for summing up float values.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-23 12:41:00 +00:00
akr
087a393fa5
* enum.c (ary_inject_op): Implement the specialized code for sum of
...
float numbers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 15:27:05 +00:00
mame
b3a65c883a
* array.c, enum.c: make rdoc format consistent.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 12:52:47 +00:00
mame
4ca0483a28
* array.c (rb_ary_max, rb_ary_min): implement Array#max and min with
...
arguments. replace super call with rb_nmin_run.
* enum.c (nmin_run): exported (as rb_nmin_run).
* internal.h: added a prototype for rb_nmin_run.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 12:37:20 +00:00
mame
68a6f2e9e0
* array.c (rb_ary_max, rb_ary_min): Array#max and Array#min added.
...
[Feature #12172 ]
* internal.h (OPTIMIZED_CMP): moved from enum.c so that array.c can
use it.
* test/ruby/test_array.rb (test_max, test_min): tests for Array#max
and Array#min.
* test/ruby/test_enum.rb (test_max, test_min): revised a bit to test
Enumerable#max and #min explicitly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 12:14:21 +00:00
mame
a22455199b
* internal.c: struct cmp_opt_data added for refactoring out a data
...
structure for CMP_OPTIMIZABLE
* array.c (struct ary_sort_data): use struct cmp_opt_data.
* enum.c (struct min_t, max_t, min_max_t): use struct cmp_opt_data.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 12:03:48 +00:00
akr
85473c481e
* enum.c (ary_inject_op): Extracted from enum_inject.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 11:55:58 +00:00
akr
fa153d7435
* enum.c (enum_inject): Implement the specialized code for sum of
...
integers including Bignums.
* internal.h (rb_fix_plus): Declared to be usable from enum_inject.
* numeric.c (rb_fix_plus): Defined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 09:50:19 +00:00
akr
32674b167b
* enum.c (enum_inject): Consider redefinition of Fixnum#+.
...
[ruby-dev:49510] [Bug#12178] Reported by usa.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-15 12:53:06 +00:00
akr
43e20c6a9a
* enum.c (enum_inject): Implement the specialied code for :+ operator
...
for Fixnums.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-15 11:42:23 +00:00
akr
95d2ec93bc
* enum.c (enum_inject): Implement the specialized code for self is an
...
array and a symbol operator is given.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-15 11:27:34 +00:00
nobu
93eb95f0b9
Rename parameter name
...
* enum.c (enum_take_while, enum_drop_while): rename block
parameter to obj, since they are generic objects. [Fix GH-1226]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-29 07:18:10 +00:00
shugo
3dcd4b2a98
* enum.c (enum_min, enum_max): do the same optimization as r53454.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-07 15:07:25 +00:00
shugo
9f44b77a18
* enum.c (enum_minmax): optimize object comparison in
...
Enumerable#minmax.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-07 13:06:23 +00:00
hsbt
52cd994814
* enum.c: fix a typo in documentation.
...
[ci skip][fix GH-1140] Patch by @jutaz
* io.c: ditto.
* iseq.c: ditto.
* numeric.c: ditto.
* process.c: ditto.
* string.c: ditto.
* vm_trace.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-14 02:52:14 +00:00
akr
8595d3099a
add a comment.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-04 14:42:52 +00:00
akr
ddb3fbc63d
* enum.c (nmin_filter): Fix limit value.
...
patch by Helder Pereira.
[Bug #11471 ] [ruby-core:70477]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-04 14:41:55 +00:00
nobu
4191a6b90d
preserve encodings in error messages
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-28 02:40:46 +00:00
hsbt
54a8318ecd
* enum.c: added doc for Enumerable#zip
...
[fix GH-985] Patch by @yui-knk
* test/ruby/test_enum.rb: added tests for Enumerable#zip
[fix GH-985] Patch @yui-knk
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-11 01:48:20 +00:00
hsbt
aebf152ea4
* Add test case for empty array and first method with args.
...
Patch by @yui-knk [fix GH-955]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-04 10:43:38 +00:00
normal
df11c9c5e2
enum.c: remove volatile, use RB_GC_GUARD
...
volatile appears unnecessary in most cases as the VALUEs are used as
arguments of uninlined functions. Even worse, volatile can be
insufficient in places where RB_GC_GUARD is necessary.
* enum.c (zip_ary): remove volatile, use RB_GC_GUARD
(zip_i): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-04 05:49:35 +00:00
hsbt
8430f93b8f
* Add test for Enumerable#none? [fix GH-950] Patch by @yui-knk
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01 01:55:03 +00:00
normal
9f1c009497
enum.c (enum_minmax): simplify return value creation
...
No need to call three functions on success when one will do.
This results in less LoC and smaller object code, too:
text data bss dec hex filename
33860 0 296 34156 856c gcc/enum.o-before
33852 0 296 34148 8564 gcc/enum.o
* enum.c (enum_minmax): simplify return value creation
* test/ruby/test_enum.rb: test behavior on empty
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-25 23:06:48 +00:00
akr
11aa7c9604
* enum.c (enum_chunk_while): New method Enumerable#chunk_while.
...
[ruby-core:67738] [Feature #10769 ] proposed by Tsuyoshi Sawada.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-14 08:54:19 +00:00
gogotanaka
8305152dc0
enum.c: [DOC] Fix typo [ci skip][Fix GH-904]
...
Patch provided by @jwworth
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-01 05:38:59 +00:00
hsbt
cff3676c94
* enum.c: fix a sample code. Patch by @eagletmt
...
[fix GH-901][ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-16 12:38:11 +00:00
sorah
71588d17e5
* enum.c (enum_grep_v, grep_i, grep_iter_i, Init_enum):
...
Implement Enumerable#grep_v.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-14 10:42:42 +00:00
glass
d77f4934f8
* enum.c (enum_to_a): revert r50457.
...
it requires recursion check.
then, it doesn't make performance improvement.
[Bug #11130 ] [Feature #9118 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-13 08:18:58 +00:00
glass
95f54fb019
* enum.c (enum_to_a): fix incompatibility introduced in r50457.
...
[Bug #11130 ]
* test/ruby/test_enum.rb: test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-12 13:24:53 +00:00
glass
d908180164
* enum.c (enum_to_a): Use size to set array capa when possible.
...
the patch is from HonoreDB <aweiner at mdsol.com>.
[fix GH-444]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-10 02:25:33 +00:00
glass
2ce35ac863
Revert "temp".
...
It's my fault.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-10 02:19:55 +00:00
glass
615a868b4b
Revert "capa"
...
It's my fault.
This reverts commit 5e17fc6bc7cb8b0e58b05fa9ebf2c47ec73ecbb3.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-10 02:12:16 +00:00