aboutsummaryrefslogtreecommitdiffstats
path: root/bignum.c
Commit message (Collapse)AuthorAgeFilesLines
* * $Date$ keyword removed to avoid inclusion of locale dependentakr2008-01-061-1/+0
| | | | | | | string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (conv_digit): use ISDIGIT, ISLOWER and ISUPPER.akr2008-01-021-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* don't need to include ruby/util.h.akr2008-01-021-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * util.c (ruby_strtoul): locale independent strtoul is implemented toakr2008-01-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | avoid "i".to_i(36) cause 0 under tr_TR locale. This is newly implemented, not a copy of missing/strtoul.c. * include/ruby/ruby.h (ruby_strtoul): declared. (STRTOUL): defined to use ruby_strtoul. * bignum.c, pack.c, ext/socket/socket.c: use STRTOUL. * configure.in (strtoul): don't check. * missing/strtoul.c: removed. * include/ruby/missing.h (strtoul): removed. * common.mk (strtoul.o): removed. * LEGAL (missing/strtoul.c): removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix typos.akr2007-12-311-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * pack.c (pack_pack): use NUM2LONG instead of NUM2INT.usa2007-12-241-3/+3
| | | | | | | | | | | * numeric.c (fix_lshift, fix_aref): use SIZEOF_LONG instead of SIZEOF_VALUE. * bignum.c (big2ulong, rb_big_aref): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_mul0): remove unused variable.matz2007-12-211-2/+0
| | | | | | * bignum.c (bigdivrem): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * regerror.c, string.c, io.c, lib/getoptlong.rb, lib/net/imap.rb,akr2007-12-211-3/+3
| | | | | | | | | | | compile.c, sprintf.c, parse.y, ext/win32ole/win32ole.c, ext/tk/sample/demos-en/entry3.rb, ext/tk/lib/tcltk.rb, ext/openssl/ossl_bn.c, numeric.c, vm.c, benchmark/bm_so_meteor_contest.rb, bignum.c, ruby.c: don't "illegal" for non law violation context. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (big2str_orig): access beyond memory region cause crashmatz2007-12-201-2/+2
| | | | | | | on interrupt. a patch from Yusuke ENDOH <mame AT tsg.ne.jp> in [ruby-dev:32651]. [ruby-dev:32641] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigmul1): C99ism.usa2007-12-191-3/+5
| | | | | | | | * bignum.c (bigdivrem1): need dummy return value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_mul0): blocking check for bigger numbers.matz2007-12-191-19/+81
| | | | | | | | a patch from Yusuke ENDOH <mame AT tsg.ne.jp> in [ruby-dev:32632]. * bignum.c (bigdivrem): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_cstr_to_inum): an underscore succeeding after octalnobu2007-12-191-1/+1
| | | | | | | prefix is allowed. [ruby-core:14139] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_cstr_to_inum): wrong radix check. a patch frommatz2007-12-181-2/+2
| | | | | | | | Yusuke ENDOH <mame AT tsg.ne.jp> in [ruby-dev:32628]. * bignum.c (big2str_find_n1): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_cstr_to_inum): trailing spaces may exist at sqeezingnobu2007-12-041-1/+1
| | | | | | | preceeding 0s. [ruby-core:13873] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (big2str_find_n1): removed extraneous element.nobu2007-11-271-20/+21
| | | | | | | | | | | [ruby-dev:32351], [ruby-dev:32365] * bignum.c (big2str_find_n1): returns necessary digits now. * sprintf.c (remove_sign_bits): extends sign bit first. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_odd_p): new method added. a patch from Tadashimatz2007-11-161-0/+34
| | | | | | | | Saito <shiba AT mail2.accsnet.ne.jp>. [ruby-dev:32305] * bignum.c (rb_big_even_p): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h: introduce 2 macros:ko12007-11-131-13/+13
| | | | | | | | | | | | | | | RFLOAT_VALUE(v), DOUBLE2NUM(dbl). Rename RFloat#value -> RFloat#double_value. Do not touch RFloat#double_value directly. * bignum.c, insns.def, marshal.c, math.c, numeric.c, object.c, pack.c, parse.y, process.c, random.c, sprintf.c, string.c, time.c: apply above changes. * ext/dl/mkcallback.rb, ext/json/ext/generator/generator.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c: use SIZEOF_LONG instead of SIZEOF_ULONG which is notakr2007-09-291-4/+4
| | | | | | | defined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (struct RBignum): embed digits in RBignum forakr2007-09-011-163/+219
| | | | | | | | | | | | | | | | | | | | | | | | | | | small bignums. * bignum.c: RBignum embeded digits implemented. * include/ruby/intern.h: declare rb_big_resize. * gc.c: don't free embedded digits. * numeric.c: replace direct bignum field accessor by abstract field accessor such as RBIGNUM(val)->sign to RBIGNUM_SIGN(val). * sprintf.c: ditto. * compar.c: ditto. * marshal.c: ditto. * random.c: ditto. * .gdbinit: support embedded small bignums. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c: provide basic features for M17N.matz2007-08-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * parse.y: encoding aware parsing. * parse.y (pragma_encoding): encoding specification pragma. * parse.y (rb_intern3): encoding specified symbols. * string.c (rb_str_length): length based on characters. for older behavior, bytesize method added. * string.c (rb_str_index_m): index based on characters. rindex as well. * string.c (succ_char): encoding aware succeeding string. * string.c (rb_str_reverse): reverse based on characters. * string.c (rb_str_inspect): encoding aware string description. * string.c (rb_str_upcase_bang): encoding aware case conversion. downcase, capitalize, swapcase as well. * string.c (rb_str_tr_bang): tr based on characters. delete, squeeze, tr_s, count as well. * string.c (rb_str_split_m): split based on characters. * string.c (rb_str_each_line): encoding aware each_line. * string.c (rb_str_each_char): added. iteration based on characters. * string.c (rb_str_strip_bang): encoding aware whitespace stripping. lstrip, rstrip as well. * string.c (rb_str_justify): encoding aware justifying (ljust, rjust, center). * string.c (str_encoding): get encoding attribute from a string. * re.c (rb_reg_initialize): encoding aware regular expression * sprintf.c (rb_str_format): formatting (i.e. length count) based on characters. * io.c (rb_io_getc): getc to return one-character string. for older behavior, getbyte method added. * ext/stringio/stringio.c (strio_getc): ditto. * io.c (rb_io_ungetc): allow pushing arbitrary string at the current reading point. * ext/stringio/stringio.c (strio_ungetc): ditto. * ext/strscan/strscan.c: encoding support. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigtrunc): RBIGNUM(x)->len may be zero. out of boundmatz2007-08-161-0/+1
| | | | | | | | | access. [ruby-dev:31404] * sprintf.c (rb_str_format): small float should not call rb_dbl2big(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (big_lshift): make shift offset long type.akr2007-08-161-10/+11
| | | | | | | | | | (big_rshift): ditto. (rb_big_lshift): ditto. (big_rshift): ditto. [ruby-dev:31434] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big2str0): should not use RTEST for non-VALUE.nobu2007-08-081-6/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big2str0): should preserve sign mark.usa2007-08-081-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big2str0): make Bignum#to_s even faster. a patchmatz2007-08-061-150/+259
| | | | | | from Kenta Murata <muraken AT gmail.com>. [ruby-dev:31354] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (big2str_table): base cannot be 0 or 1.nobu2007-08-021-5/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big2str0): faster Bugnum#to_s using Karatsubamatz2007-08-021-19/+111
| | | | | | | | algorithm. a patch from Yusuke ENDOH <mame AT tsg.ne.jp> in [ruby-dev:31312], slightly modified by Kenta Murata <muraken AT gmail.com> in [ruby-dev:31339]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_aref): check for Bignum index range.nobu2007-07-301-12/+22
| | | | | | | [ruby-dev:31271] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_lshift, rb_big_rshift): separated functionsnobu2007-07-191-9/+87
| | | | | | | | | | to get rid of infinite recursion. fixed calculation in edge cases. [ruby-dev:31244] * numeric.c (rb_fix_lshift, rb_fix_rshift): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_pow): refine overflow check. [ruby-dev:31242]nobu2007-07-181-1/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_pow): removed invariant variable. [ruby-dev:31236]nobu2007-07-151-15/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (get2comp): do nothing for empty Bignum. [ruby-dev:31225]nobu2007-07-151-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_cstr_to_inum): check leading non-digits.nobu2007-07-151-15/+16
| | | | | | | [ruby-core:11691] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (get2comp): do nothing for empty Bignum. [ruby-dev:31225]nobu2007-07-141-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* refine previous change.akr2007-06-281-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_hash): fix hash area.akr2007-06-281-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h: IL32LLP64 support.usa2007-06-261-3/+3
| | | | | | | | | | * bignum.c (bigfixize, rb_cstr_to_inum): ditto. * insns.def (opt_plus, opt_minus, opt_mult): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby: moved public headers.nobu2007-06-101-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c: purged trailing spaces.nobu2007-05-091-37/+37
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (Init_Bignum), numeric.c (Init_Numeric): added fdiv asnobu2007-05-091-0/+2
| | | | | | | aliases of quo. [ruby-dev:30771] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_quo): now calculate in integer. [ruby-dev:30753]nobu2007-05-021-6/+64
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_pow): improvement by calculating from MSB and usingnobu2007-05-011-11/+64
| | | | | | | factorization. <http://yowaken.dip.jp/tdiary/20070426.html#p01> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_pow): truncate all zero BDIGITs. [ruby-dev:30733]nobu2007-04-261-20/+34
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_pow): reduce multiplying for even number.nobu2007-04-261-7/+5
| | | | | | | | * numeric.c (int_pow): calculate power in Fixnum as possible. [ruby-dev:30726] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big2str0): round up for the most significant digit.nobu2007-03-211-4/+4
| | | | | | | [ruby-core:10686] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big2str0): use better approximation.usa2006-10-301-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big2str0): wrong allocation length.matz2006-10-301-1/+1
| | | | | | | [ruby-dev:29710] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * sprintf.c (rb_str_format): should preserve leading zeromatz2006-10-301-12/+24
| | | | | | | information for negative %b and %x. [ruby-talk:221347] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_rshift): a bug in right shift of negativematz2006-10-071-0/+4
| | | | | | | bignums. [ruby-core:09020] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_hash): use rb_memhash().matz2006-09-211-7/+3
| | | | | | | | * numeric.c (flo_hash): simplified. klass need not to affect resulting hash value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e