summaryrefslogtreecommitdiff
path: root/bignum.c
AgeCommit message (Collapse)Author
2024-06-05[Bug #20524] win32: Suppress GMP warningNobuyoshi Nakada
``` C:\vcpkg\installed\x64-windows\include\gmp.h(2237): warning C4146: unary minus operator applied to unsigned type, result still unsigned ```
2024-03-18Faster Integer.sqrt for large bignumtompng
Integer.sqrt uses Newton's method. This pull request reduces the precision which was unnecessarily high in each calculation step.
2024-03-06Refactor VM root modulesJean Boussier
This `st_table` is used to both mark and pin classes defined from the C API. But `vm->mark_object_ary` already does both much more efficiently. Currently a Ruby process starts with 252 rooted classes, which uses `7224B` in an `st_table` or `2016B` in an `RArray`. So a baseline of 5kB saved, but since `mark_object_ary` is preallocated with `1024` slots but only use `405` of them, it's a net `7kB` save. `vm->mark_object_ary` is also being refactored. Prior to this changes, `mark_object_ary` was a regular `RArray`, but since this allows for references to be moved, it was marked a second time from `rb_vm_mark()` to pin these objects. This has the detrimental effect of marking these references on every minors even though it's a mostly append only list. But using a custom TypedData we can save from having to mark all the references on minor GC runs. Addtionally, immediate values are now ignored and not appended to `vm->mark_object_ary` as it's just wasted space.
2024-02-15Do not include a backtick in error messages and backtracesYusuke Endoh
[Feature #16495]
2024-02-12Replace assert with RUBY_ASSERT in bignum.cPeter Zhu
assert does not print the bug report, only the file and line number of the assertion that failed. RUBY_ASSERT prints the full bug report, which makes it much easier to debug.
2024-01-08Adjust styles and indents [ci skip]Nobuyoshi Nakada
2023-06-30* expand tabs. [ci skip]git
Please consider using misc/expand_tabs.rb as a pre-commit hook.
2023-06-30Compile debugging code for integer pack alwaysNobuyoshi Nakada
2023-04-06[Feature #19474] Refactor NEWOBJ macrosMatt Valentine-House
NEWOBJ_OF is now our canonical newobj macro. It takes an optional ec Notes: Merged: https://github.com/ruby/ruby/pull/7393
2023-03-06Stop exporting symbols for MJITTakashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/7459
2023-01-30bignum.c: rb_int_parse_cstr handle `0` stringsJean Boussier
[Bug #19390] We shouldn't check the string length when skipping zeros, as the string might only contains zero characters, resulting in an empty string. Notes: Merged: https://github.com/ruby/ruby/pull/7196
2023-01-08[Bug #19323] Raise `RangeError` instead of integer overflowNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7087 Merged-By: nobu <[email protected]>
2022-10-14Use `roomof` macro for rounding up divisionsNobuyoshi Nakada
2022-07-21Expand tabs [ci skip]Takashi Kokubun
[Misc #18891] Notes: Merged: https://github.com/ruby/ruby/pull/6094
2022-06-02Fix the condition when a new buffer is needed without GMPNobuyoshi Nakada
2022-05-20Disable GMP by -DUSE_GMP=0Nobuyoshi Nakada
2022-04-09[DOC]Some link prefix replaceS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/5783
2021-12-29[DOC] Integer#coerce deals with also FloatNobuyoshi Nakada
2021-12-29Fix the warning in rb_big2dbl, Bignum is no longer definedNobuyoshi Nakada
2021-12-28Remove obsolete Fixnum and BignumNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3927
2021-11-08[Feature #18290] Remove all usages of rb_gc_force_recyclePeter Zhu
This commit removes usages of rb_gc_force_recycle since it is a burden to maintain and makes changes to the GC difficult. Notes: Merged: https://github.com/ruby/ruby/pull/4363
2021-10-12bary_mul_balance_with_mulfunc: move working buffer allocationNobuyoshi Nakada
Move the allocation of working buffer before the loop. Notes: Merged: https://github.com/ruby/ruby/pull/4949
2021-10-12bary_mul_balance_with_mulfunc: consitify invariant variablesNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4949
2021-09-15Refactor and Using RBOOL macroS.H
Notes: Merged: https://github.com/ruby/ruby/pull/4837 Merged-By: nobu <[email protected]>
2021-09-13Remove uneeded initialize local variable (#4818)S.H
Notes: Merged-By: k0kubun <[email protected]>
2021-09-11Using RB_BIGNUM_TYPE_P macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/4805
2021-09-05Replace RBOOL macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/4791
2021-08-27Use C99-defined macros to classify a floating-point numberNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4783
2021-08-24Moved exported symbols in internal/util.h to ruby/util.hNobuyoshi Nakada
[Feature #18051] Notes: Merged: https://github.com/ruby/ruby/pull/4763
2021-08-09Suppress unused-variable warnings when DEBUG_INTEGER_PACKNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4720
2021-03-20Remove unneeded declarations in bignum.cS.H
Notes: Merged: https://github.com/ruby/ruby/pull/4271 Merged-By: nobu <[email protected]>
2021-01-23bignum.c: Make sure the argument of LONG2FIX is longYusuke Endoh
... because BDIGIT_DBL may be long long. POSFIXABLE and NEGFIXABLE ensures that the value is representable as long, but it failed to build on emscripten with -Werror -Wshorten-64-to-32.
2021-01-05[DOC] Fix grammar: "is same as" -> "is the same as"Marcus Stollsteimer
2020-12-21Fixed indefinite articles before "Integer" [ci skip]Nobuyoshi Nakada
2020-10-12bignum.c (bary_sparse_p): do not comsume Random::DEFAULTYusuke Endoh
It uses random to determine if the bignum is sparse or not. It is arguable if three-digit samples are enough or not to determine it, but anyway, consuming Random source implicitly is not good. I introduced the random sampling mechanism, and I don't know any significant reason to do so. So, let's remove it. This change makes the sampling points fixed: 40th, 50th, and 60th percentiles.
2020-10-12bignum.c (rb_int_powm): Integer#pow(0, 1) should return 0Yusuke Endoh
... instead of 1 because it requires "modulo 1". [Bug #17257]
2020-07-28Use https instead of httpKazuhiro NISHIYAMA
2020-07-14ON_DEBUG: delete unused macro卜部昌平
This is no longer used.
2020-06-29rb_big_aref: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29rb_int_parse_cstr: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29str2big_scan_digits: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29bary_mul_karatsuba_branch: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-05-29Respect BIGNUM_DEBUG defined by command line optionNobuyoshi Nakada
And fixed typo in compilers.yml.
2020-05-11sed -i 's|ruby/impl|ruby/internal|'卜部昌平
To fix build failures. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-05-11sed -i s|ruby/3|ruby/impl|g卜部昌平
This shall fix compile errors. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-04-08Merge pull request #2991 from shyouhei/ruby.h卜部昌平
Split ruby.h Notes: Merged-By: shyouhei <[email protected]>
2020-03-21Removed non-RUBY_INTEGER_UNIFICATION codeNobuyoshi Nakada
2020-03-21Leave power cache table initialized as QfalseNobuyoshi Nakada
2020-03-04suppress uninitialized variable warnings卜部昌平
Starting GCC 7, warnings about uninitialized variables are issued around them. Such warnings could be false positives (all versions of clang do not warn), but adding initializers there could never be bad things.
2020-02-08Clarified documentation in rb_integer_unpack [ci skip]Bernhard F. Brodowsky
I struggled figuring out which of the pack/unpack functions goes into which direction and the two first sentences were of the documentation were: * Import an integer into a buffer. * Export an integer into a buffer. It sounds like both of them go from a ruby integer to a buffer because both use "into". So I fixed it and went to "Import an integer from a buffer". I find this much more clear. Notes: Merged: https://github.com/ruby/ruby/pull/2891 Merged-By: nobu <[email protected]>