From a6024cdc1bc1ff792fc07a728e8156c71a891d48 Mon Sep 17 00:00:00 2001 From: akr Date: Fri, 18 Apr 2014 15:46:32 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 14 ++++++++++++++ bignum.c | 4 ++-- include/ruby/intern.h | 4 ++-- include/ruby/ruby.h | 8 ++++---- numeric.c | 4 ++-- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4ae42a09f6..b86dac2ffe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Sat Apr 19 00:32:07 2014 Tanaka Akira + + * 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 * string.c (SHARABLE_SUBSTRING_P): predicate if substring can be diff --git a/bignum.c b/bignum.c index 83f64263a6..57f6488f62 100644 --- a/bignum.c +++ b/bignum.c @@ -4962,7 +4962,7 @@ big2ulong(VALUE x, const char *type) return num; } -VALUE +unsigned long rb_big2ulong(VALUE x) { unsigned long num = big2ulong(x, "unsigned long"); @@ -4979,7 +4979,7 @@ rb_big2ulong(VALUE x) rb_raise(rb_eRangeError, "bignum out of range of unsigned long"); } -SIGNED_VALUE +long rb_big2long(VALUE x) { unsigned long num = big2ulong(x, "long"); diff --git a/include/ruby/intern.h b/include/ruby/intern.h index c69d378f62..374dc4c402 100644 --- a/include/ruby/intern.h +++ b/include/ruby/intern.h @@ -102,9 +102,9 @@ VALUE rb_str_to_inum(VALUE, int, int); 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); diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 8de3a43010..54fa9f121d 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -592,15 +592,15 @@ NORETURN(void rb_insecure_operation(void)); 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) 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 diff --git a/numeric.c b/numeric.c index 7e5ea42cf8..08849ba707 100644 --- a/numeric.c +++ b/numeric.c @@ -2030,7 +2030,7 @@ out_of_range_float(char (*pbuf)[24], VALUE val) 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 *wrap_p) } } -VALUE +unsigned long rb_num2ulong(VALUE val) { return rb_num2ulong_internal(val, NULL);