[ruby-cvs:68185] mrkn:r61003 (trunk): bignum.c, numeric.c: add Integer#pow(b, m)

mrkn at ruby-lang.org mrkn at ruby-lang.org
Mon Dec 4 11:35:40 JST 2017


mrkn	2017-12-04 11:35:40 +0900 (Mon, 04 Dec 2017)

  New Revision: 61003

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61003

  Log:
    bignum.c, numeric.c: add Integer#pow(b, m)
    
    This commit is based on the pull-request #1320 created by Makoto Kishimoto.
    [Feature #12508] [Feature #11003] [close GH-1320]
    
    * bignum.c (rb_int_powm): Added for Integer#pow(b, m).
    
    * internal.h (rb_int_powm): Declared to refer in numeric.c.
    
    * bignum.c (bary_powm_gmp): Added for Integer#pow(b, m) using GMP.
    
    * bignum.c (int_pow_tmp1): Added for implementing Integer#pow(b, m).
    
    * bignum.c (int_pow_tmp2, int_pow_tmp3): ditto.
    
    * internal.h (rb_num_positive_int_p): Moved from numeric.c for sharing
      the definition with bignum.c.
    
    * internal.h (rb_num_negative_int_p, rb_num_compare_with_zero): ditto.
    
    * numeric.c(negative_int_p): Moved to internal.h for sharing the
      definition with bignum.c.
    
    * numeric.c (positive_int_p, compare_with_zero): ditto.
    
    * numeric.c (rb_int_odd_p): Exported (renamed from int_odd_p).
    
    * internal.h (rb_int_odd_p): ditto.
    
    * internal.h (HALF_LONG_MSB): Added.
    
    * numeric.c (SQRT_LONG_MAX): Redefined by using HALF_LONG_MSB.
    
    * test/ruby/test_numeric.rb (test_pow): Added for Integer#pow(b, m).

  Modified files:
    trunk/bignum.c
    trunk/internal.h
    trunk/numeric.c
    trunk/test/ruby/test_numeric.rb


More information about the ruby-cvs mailing list