Yukihiro "Matz" Matsumoto
c218894af9
mruby-bigint: use mp_limb instead of uint32_t
...
Because mp_limb may be uint16_t on some platforms.
2024-07-27 18:54:48 +09:00
Yukihiro "Matz" Matsumoto
a50a2ce148
.gitingore: add entries (.cache, gmon.out, perf.data)
2024-07-27 18:53:55 +09:00
Yukihiro "Matz" Matsumoto
2247e4f355
mruby-bigint (mpz_xor): simplify the code
2024-07-27 18:53:36 +09:00
Yukihiro "Matz" Matsumoto
b573a8430f
mruby-bigint (mpz_or): simplify the code
2024-07-27 18:50:09 +09:00
Yukihiro "Matz" Matsumoto
dea1cc18a6
mruby-bigint (mpz_and): simplify the code
2024-07-27 18:48:01 +09:00
Yukihiro "Matz" Matsumoto
bf081c3d3d
mruby-bigint (mrb_bint_and): further optimization for bint & int
2024-07-25 17:46:36 +09:00
Yukihiro "Matz" Matsumoto
99c078bb6b
mruby-bigint (mrb_bint_2comp): simplify using mpz_2comp()
2024-07-25 16:18:49 +09:00
Yukihiro "Matz" Matsumoto
3d69412ea5
mruby-bigint: Distinguish uzero_p(x) and x->sn == 0
...
The latter is a check for integers that have been set up (and disclosed to the
outer world), while the former is a check for integers that are being worked on.
2024-07-25 16:18:48 +09:00
Yukihiro "Matz" Matsumoto
93653dfd4c
mruby-bigint (uzero_p): add fast path
2024-07-25 16:18:48 +09:00
Yukihiro "Matz" Matsumoto
4ee7c8e021
mruby-bigint: rename uzero to uzero_p
...
Since uzero() is a predicate, and zero() is a function to assign zero to
mpz_t, it's confusion. Rename predicate uzero() to uzero_p() to follow
mruby naming convention.
2024-07-25 16:18:48 +09:00
Yukihiro "Matz" Matsumoto
88536ebe30
mruby-bigint (mpz_xor): support bit-wise xor with negative numbers; #6314
2024-07-25 16:18:48 +09:00
Yukihiro "Matz" Matsumoto
ee2eb6c87e
mruby-bigint (mpz_or): support bit-wise or with negative numbers; #6314
2024-07-25 16:18:48 +09:00
Yukihiro "Matz" Matsumoto
69a80c94b9
mruby-bigint (mpz_and): support bit-wise and with negative numbers
...
Negative integers are virtually considered as 2's compliment of the
absolute value of the corresponding number. It means `-1` is considered
as infinite sequence of `1` toward msb side. ref #6314
2024-07-25 16:18:48 +09:00
Yukihiro "Matz" Matsumoto
e3a459d5b9
mruby-bigint (mrb_bint_and): optimize bint & fixnum operation; ref #6314
2024-07-25 16:18:48 +09:00
Yukihiro "Matz" Matsumoto
c16aba9280
mruby-bigint: remove special handling of Float in bitwise operations
...
CRuby raises TypeError with float numbers as operands; ref #6314
2024-07-25 16:18:47 +09:00
Yukihiro "Matz" Matsumoto
81a9eef591
Merge pull request #6313 from hoshiumiarata/fix_typo_in_opcode_doc
2024-07-24 12:28:52 +09:00
Yukihiro "Matz" Matsumoto
b4ffddebdf
Merge pull request #6314 from hoshiumiarata/optimize_int_even
2024-07-24 08:11:43 +09:00
Hoshiumi Arata
612941dcbc
Add test code for even?/odd?
2024-07-23 21:09:17 +09:00
Hoshiumi Arata
80502b30fb
Optimize even?/odd? for big integers
2024-07-23 21:05:10 +09:00
Hoshiumi Arata
35571df7ea
Update opcode.md: fix wrong column number
2024-07-23 20:25:22 +09:00
Yukihiro "Matz" Matsumoto
bb4a8c2410
Merge pull request #6311 from dearblue/OP_SEND
2024-07-23 11:04:20 +09:00
Yukihiro "Matz" Matsumoto
6a03647fc0
Merge pull request #6309 from dearblue/mrb_type
2024-07-23 07:26:04 +09:00
Yukihiro "Matz" Matsumoto
d2878138d9
mruby-numeric-ext: implement Integer#even? and Integer#odd?
2024-07-23 07:23:13 +09:00
Yukihiro "Matz" Matsumoto
9d709164dc
Merge pull request #6308 from dearblue/vm-catch
2024-07-22 16:29:56 +09:00
Yukihiro "Matz" Matsumoto
f3b570f33a
mruby-enumerator: add test for Enumerable#chunk_while
2024-07-22 13:52:12 +09:00
dearblue
ce847c1aa9
Added fast-path for positional arguments less than 15 in OP_SEND
2024-07-21 21:58:18 +09:00
dearblue
e76bebe836
Perform pseudo binary search with mrb_type()
2024-07-21 21:58:18 +09:00
dearblue
45007888f5
Assume that MRB_CATCH() has mrb->exc set
...
The caller of `MRB_EXC_THROW()` must be preconfigured.
2024-07-21 21:58:18 +09:00
Yukihiro "Matz" Matsumoto
dcbe2e3eb3
mruby-enumerator: add Enumerable#chunk_while
2024-07-21 20:29:27 +09:00
Yukihiro "Matz" Matsumoto
7d8fc3b35f
Merge pull request #6305 from dearblue/method_missing
...
Protect keyword arguments in `prepare_missing()`
2024-07-20 22:04:50 +09:00
dearblue
890dda79d0
Protect keyword arguments in prepare_missing()
...
Previously, keyword arguments were lost if no positional arguments were passed.
Fixed #6304
2024-07-20 16:25:11 +09:00
Yukihiro "Matz" Matsumoto
3ec6038505
Merge pull request #6299 from mruby/dependabot/github_actions/super-linter/super-linter-6.7.0
...
build(deps): bump super-linter/super-linter from 6.6.0 to 6.7.0
2024-07-20 15:25:20 +09:00
dependabot[bot]
6c4ea4cd10
build(deps): bump super-linter/super-linter from 6.6.0 to 6.7.0
...
Bumps [super-linter/super-linter](https://github.com/super-linter/super-linter ) from 6.6.0 to 6.7.0.
- [Release notes](https://github.com/super-linter/super-linter/releases )
- [Changelog](https://github.com/super-linter/super-linter/blob/main/CHANGELOG.md )
- [Commits](https://github.com/super-linter/super-linter/compare/v6.6.0...v6.7.0 )
---
updated-dependencies:
- dependency-name: super-linter/super-linter
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com >
2024-07-20 06:16:03 +00:00
Yukihiro "Matz" Matsumoto
9326c514c5
mruby-enum-ext: add Enumerable#each_entry test
2024-07-20 14:20:15 +09:00
Pete Kinnecom
509590c18d
Method missing kwargs test failure:
...
Fail: Method#call with undefined method -- only kwargs (mrbgems: mruby-method)
- Assertion[6]
NoMethodError exception expected, not
Class: <TypeError>
Message: <Array cannot be converted to Hash>
- Assertion[9]
Expected: {:kwarg1=>:val1, :kwarg2=>:val2}
Actual: [:foo]
2024-07-19 20:37:40 +00:00
Yukihiro "Matz" Matsumoto
c539256b43
mruby-enum-ext: add Enumerable#each_entry
2024-07-19 23:29:45 +09:00
Yukihiro "Matz" Matsumoto
313c5a31ac
test/hash.rb: add tests for Hash#assoc and Hash#rassoc
2024-07-18 15:09:49 +09:00
Yukihiro "Matz" Matsumoto
398e669bbf
hash.c: add Hash#assoc and Hash#rassoc
2024-07-18 15:06:31 +09:00
Yukihiro "Matz" Matsumoto
1fc8c20723
Merge pull request #6303 from hasumikin/fix/return-value-of-String_aset
...
mrb_str_aset_m() should return replace instead of str
2024-07-17 09:49:34 +09:00
Yukihiro "Matz" Matsumoto
cd8582a011
hash.c: define Hash#to_hash
2024-07-17 09:46:46 +09:00
Yukihiro "Matz" Matsumoto
45078d9a49
mruby-string-ext: fixed typo (casecmp! -> casecmp?)
2024-07-17 02:25:49 +09:00
HASUMI Hitoshi
cc16afb7f3
mrb_str_aset_m() should return replace instead of str
...
`string[]=(idx, replace)` should return `replace`.
## Actual (wrong)
```
string.[]=(idx, replace) → string
string.[]=(idx, len, replace) → string
```
## Expected
```
string.[]=(idx, replace) → replace
string.[]=(idx, len, replace) → replace
```
## Sidenote
As of the current mruby-compiler, `(string[idx] = 'X')` creates not only "CALL_NODE" but also "ASGN_NODE" and "OP_MOVE", overriding the wrong return value.
On the other hand, `string.[]=(idx, 'X')` creates only "CALL_NODE", exposing the wrong return value.
If my new mruby-compiler2, leveraging Prism, took the place of official compiler, `(string[idx] = 'X')` and `string.[]=(idx, 'X')` would be going to generate the same VM code without "OP_MOVE".
So I paranoidly added tests.
FYI: You can find how the new mruby-compiler2's AST and VM code look like in mruby/c's issue (mruby/c had the same bug): https://github.com/mrubyc/mrubyc/pull/210
2024-07-16 18:55:26 +09:00
Yukihiro "Matz" Matsumoto
ac8846dbce
numeric.c: add Numeric#fdiv
2024-07-15 22:16:52 +09:00
Yukihiro "Matz" Matsumoto
301242c822
numeric.c (int_fdiv): add Integer#fdiv and Float#fdiv
2024-07-15 22:16:52 +09:00
Yukihiro "Matz" Matsumoto
4faab0581e
Merge pull request #6302 from auroranockert/minor-mrb-str-init-cleanup
...
Minor cleanup in mrb_str_init
2024-07-15 21:38:48 +09:00
Yukihiro "Matz" Matsumoto
ca28e639c6
mruby-numeric-ext: move allbits?, anybits?, nobits? to Integer class
2024-07-15 21:35:42 +09:00
Yukihiro "Matz" Matsumoto
3f5138a6ac
mruby-numeric-ext: implement Numeric#integer? method
2024-07-15 21:35:42 +09:00
Yukihiro "Matz" Matsumoto
1a8df40392
mruby-enum-ext: add Array#sort_by! method
2024-07-15 21:35:42 +09:00
Yukihiro "Matz" Matsumoto
fcab7ef377
numeric.c (int_div): fixed a bug regarding bigint / non-integer
...
Non-integer means Complex or Rational.
2024-07-15 21:35:42 +09:00
Yukihiro "Matz" Matsumoto
bcba0bc674
Merge pull request #6300 from jbampton/fix-spelling
...
Fix spelling
2024-07-15 21:35:43 +09:00