ruby-changes:33553
From: akr <ko1@a...>
Date: Sat, 19 Apr 2014 00:46:38 +0900 (JST)
Subject: [ruby-changes:33553] akr:r45634 (trunk): * numeric.c (rb_num2long): Returns a long.
akr 2014-04-19 00:46:32 +0900 (Sat, 19 Apr 2014) New Revision: 45634 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45634 Log: * numeric.c (rb_num2long): Returns a long. (rb_num2ulong): Returns a unsigned long. * bignum.c (rb_big2long): Returns a long. (rb_big2ulong): Returns a unsigned long. * include/ruby/intern.h: Follow above changes. * include/ruby/ruby.h: Follow above changes. (rb_num2long_inline): No need to cast. (rb_num2ulong_inline): Ditto. Modified files: trunk/ChangeLog trunk/bignum.c trunk/include/ruby/intern.h trunk/include/ruby/ruby.h trunk/numeric.c Index: include/ruby/intern.h =================================================================== --- include/ruby/intern.h (revision 45633) +++ include/ruby/intern.h (revision 45634) @@ -102,9 +102,9 @@ VALUE rb_str_to_inum(VALUE, int, int); https://github.com/ruby/ruby/blob/trunk/include/ruby/intern.h#L102 VALUE rb_cstr2inum(const char*, int); VALUE rb_str2inum(VALUE, int); VALUE rb_big2str(VALUE, int); -SIGNED_VALUE rb_big2long(VALUE); +long rb_big2long(VALUE); #define rb_big2int(x) rb_big2long(x) -VALUE rb_big2ulong(VALUE); +unsigned long rb_big2ulong(VALUE); #define rb_big2uint(x) rb_big2ulong(x) #if HAVE_LONG_LONG LONG_LONG rb_big2ll(VALUE); Index: include/ruby/ruby.h =================================================================== --- include/ruby/ruby.h (revision 45633) +++ include/ruby/ruby.h (revision 45634) @@ -592,15 +592,15 @@ NORETURN(void rb_insecure_operation(void https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L592 VALUE rb_errinfo(void); void rb_set_errinfo(VALUE); -SIGNED_VALUE rb_num2long(VALUE); -VALUE rb_num2ulong(VALUE); +long rb_num2long(VALUE); +unsigned long rb_num2ulong(VALUE); static inline long rb_num2long_inline(VALUE x) { if (FIXNUM_P(x)) return FIX2LONG(x); else - return (long)rb_num2long(x); + return rb_num2long(x); } #define NUM2LONG(x) rb_num2long_inline(x) static inline unsigned long @@ -609,7 +609,7 @@ rb_num2ulong_inline(VALUE x) https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L609 if (FIXNUM_P(x)) return (unsigned long)FIX2LONG(x); else - return (unsigned long)rb_num2ulong(x); + return rb_num2ulong(x); } #define NUM2ULONG(x) rb_num2ulong_inline(x) #if SIZEOF_INT < SIZEOF_LONG Index: ChangeLog =================================================================== --- ChangeLog (revision 45633) +++ ChangeLog (revision 45634) @@ -1,3 +1,17 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Apr 19 00:32:07 2014 Tanaka Akira <akr@f...> + + * numeric.c (rb_num2long): Returns a long. + (rb_num2ulong): Returns a unsigned long. + + * bignum.c (rb_big2long): Returns a long. + (rb_big2ulong): Returns a unsigned long. + + * include/ruby/intern.h: Follow above changes. + + * include/ruby/ruby.h: Follow above changes. + (rb_num2long_inline): No need to cast. + (rb_num2ulong_inline): Ditto. + Sat Apr 19 00:17:20 2014 Nobuyoshi Nakada <nobu@r...> * string.c (SHARABLE_SUBSTRING_P): predicate if substring can be Index: numeric.c =================================================================== --- numeric.c (revision 45633) +++ numeric.c (revision 45634) @@ -2030,7 +2030,7 @@ out_of_range_float(char (*pbuf)[24], VAL https://github.com/ruby/ruby/blob/trunk/numeric.c#L2030 LONG_MIN <= (n): \ LONG_MIN_MINUS_ONE < (n)) -SIGNED_VALUE +long rb_num2long(VALUE val) { again: @@ -2100,7 +2100,7 @@ rb_num2ulong_internal(VALUE val, int *wr https://github.com/ruby/ruby/blob/trunk/numeric.c#L2100 } } -VALUE +unsigned long rb_num2ulong(VALUE val) { return rb_num2ulong_internal(val, NULL); Index: bignum.c =================================================================== --- bignum.c (revision 45633) +++ bignum.c (revision 45634) @@ -4962,7 +4962,7 @@ big2ulong(VALUE x, const char *type) https://github.com/ruby/ruby/blob/trunk/bignum.c#L4962 return num; } -VALUE +unsigned long rb_big2ulong(VALUE x) { unsigned long num = big2ulong(x, "unsigned long"); @@ -4979,7 +4979,7 @@ rb_big2ulong(VALUE x) https://github.com/ruby/ruby/blob/trunk/bignum.c#L4979 rb_raise(rb_eRangeError, "bignum out of range of unsigned long"); } -SIGNED_VALUE +long rb_big2long(VALUE x) { unsigned long num = big2ulong(x, "long"); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/