summaryrefslogtreecommitdiff
path: root/bignum.c
Commit message (Collapse)AuthorAgeFilesLines
* [Feature #19474] Refactor NEWOBJ macrosMatt Valentine-House2023-04-061-1/+2
| | | | NEWOBJ_OF is now our canonical newobj macro. It takes an optional ec
* Stop exporting symbols for MJITTakashi Kokubun2023-03-061-1/+1
|
* bignum.c: rb_int_parse_cstr handle `0` stringsJean Boussier2023-01-301-1/+0
| | | | | | | [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.
* [Bug #19323] Raise `RangeError` instead of integer overflowNobuyoshi Nakada2023-01-081-1/+4
|
* Use `roomof` macro for rounding up divisionsNobuyoshi Nakada2022-10-141-2/+2
|
* Expand tabs [ci skip]Takashi Kokubun2022-07-211-555/+555
| | | | [Misc #18891]
* Fix the condition when a new buffer is needed without GMPNobuyoshi Nakada2022-06-021-2/+14
|
* Disable GMP by -DUSE_GMP=0Nobuyoshi Nakada2022-05-201-14/+20
|
* [DOC]Some link prefix replaceS-H-GAMELINKS2022-04-091-1/+1
|
* [DOC] Integer#coerce deals with also FloatNobuyoshi Nakada2021-12-291-5/+6
|
* Fix the warning in rb_big2dbl, Bignum is no longer definedNobuyoshi Nakada2021-12-291-1/+1
|
* Remove obsolete Fixnum and BignumNobuyoshi Nakada2021-12-281-4/+0
|
* [Feature #18290] Remove all usages of rb_gc_force_recyclePeter Zhu2021-11-081-2/+0
| | | | | This commit removes usages of rb_gc_force_recycle since it is a burden to maintain and makes changes to the GC difficult.
* bary_mul_balance_with_mulfunc: move working buffer allocationNobuyoshi Nakada2021-10-121-0/+13
| | | | Move the allocation of working buffer before the loop.
* bary_mul_balance_with_mulfunc: consitify invariant variablesNobuyoshi Nakada2021-10-121-12/+11
|
* Refactor and Using RBOOL macroS.H2021-09-151-14/+5
|
* Remove uneeded initialize local variable (#4818)S.H2021-09-131-1/+0
|
* Using RB_BIGNUM_TYPE_P macroS-H-GAMELINKS2021-09-111-2/+0
|
* Replace RBOOL macroS-H-GAMELINKS2021-09-051-5/+5
|
* Use C99-defined macros to classify a floating-point numberNobuyoshi Nakada2021-08-271-1/+1
|
* Moved exported symbols in internal/util.h to ruby/util.hNobuyoshi Nakada2021-08-241-1/+0
| | | | [Feature #18051]
* Suppress unused-variable warnings when DEBUG_INTEGER_PACKNobuyoshi Nakada2021-08-091-0/+2
|
* Remove unneeded declarations in bignum.cS.H2021-03-201-4/+0
|
* bignum.c: Make sure the argument of LONG2FIX is longYusuke Endoh2021-01-231-4/+4
| | | | | | ... 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.
* [DOC] Fix grammar: "is same as" -> "is the same as"Marcus Stollsteimer2021-01-051-1/+1
|
* Fixed indefinite articles before "Integer" [ci skip]Nobuyoshi Nakada2020-12-211-1/+1
|
* bignum.c (bary_sparse_p): do not comsume Random::DEFAULTYusuke Endoh2020-10-121-3/+3
| | | | | | | | | | | 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.
* bignum.c (rb_int_powm): Integer#pow(0, 1) should return 0Yusuke Endoh2020-10-121-0/+2
| | | | ... instead of 1 because it requires "modulo 1". [Bug #17257]
* Use https instead of httpKazuhiro NISHIYAMA2020-07-281-1/+1
|
* ON_DEBUG: delete unused macro卜部昌平2020-07-141-24/+0
| | | | This is no longer used.
* rb_big_aref: do not goto into a branch卜部昌平2020-06-291-2/+2
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* rb_int_parse_cstr: do not goto into a branch卜部昌平2020-06-291-4/+6
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* str2big_scan_digits: do not goto into a branch卜部昌平2020-06-291-4/+3
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* bary_mul_karatsuba_branch: do not goto into a branch卜部昌平2020-06-291-6/+10
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* Respect BIGNUM_DEBUG defined by command line optionNobuyoshi Nakada2020-05-291-1/+4
| | | | And fixed typo in compilers.yml.
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-111-1/+1
| | | | To fix build failures.
* sed -i s|ruby/3|ruby/impl|g卜部昌平2020-05-111-1/+1
| | | | This shall fix compile errors.
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-081-10/+11
| | | Split ruby.h
* Removed non-RUBY_INTEGER_UNIFICATION codeNobuyoshi Nakada2020-03-211-6/+0
|
* Leave power cache table initialized as QfalseNobuyoshi Nakada2020-03-211-9/+3
|
* suppress uninitialized variable warnings卜部昌平2020-03-041-1/+1
| | | | | | 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.
* Clarified documentation in rb_integer_unpack [ci skip]Bernhard F. Brodowsky2020-02-081-1/+1
| | | | | | | 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.
* bignum.c: extract bdigits_to_mpz and bdigits_from_mpz (#2805)Kenta Murata2020-01-011-18/+27
|
* Introduce BIGNUM_EMBED_P to check BIGNUM_EMBED_FLAG (#2802)Kenta Murata2019-12-311-6/+6
| | | | | | * bignum.h: Add BIGNUM_EMBED_P * bignum.c: Use macros for handling BIGNUM_EMBED_FLAG
* decouple internal.h headers卜部昌平2019-12-261-12/+25
| | | | | | | | | | | | | | | | | | Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies).
* internal/bingnum.h rework卜部昌平2019-12-261-1/+1
| | | | | Turn macros into inline functions for better readability. Also add rb_int128t2big delcaration, which was missing.
* add several __has_something macro卜部昌平2019-12-261-2/+0
| | | | | | | With these macros implemented we can write codes just like we can assume the compiler being clang. MSC_VERSION_SINCE is defined to implement those macros, but turned out to be handy for other places. The -fdeclspec compiler flag is necessary for clang to properly handle __has_declspec().
* make functions static卜部昌平2019-11-191-1/+3
| | | | | | | These functions are used from within a compilation unit so we can make them static, for better binary size. This changeset reduces the size of generated ruby binary from 26,590,128 bytes to 26,584,472 bytes on my macihne.
* bignum.c (estimate_initial_sqrt): prevent integer overflowYusuke Endoh2019-10-211-1/+9
| | | | | `Integer.sqrt(0xffff_ffff_ffff_ffff ** 2)` caused assertion failure because of integer overflow. [ruby-core:95453] [Bug #16269]
* Unused LONG_MAX_as_doubleNobuyoshi Nakada2019-09-101-0/+2
| | | | | LONG_MAX_as_double is not needed when long is small enough to be exactly representable as a double, e.g., IL32LLP64 platforms.