summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--bignum.c4
-rw-r--r--include/ruby/intern.h4
-rw-r--r--include/ruby/ruby.h8
-rw-r--r--numeric.c4
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 <akr@fsij.org>
+
+ * 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@ruby-lang.org>
* 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);