* 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
This commit is contained in:
akr 2014-04-18 15:46:32 +00:00
Родитель 07cad43677
Коммит a6024cdc1b
5 изменённых файлов: 24 добавлений и 10 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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");

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

@ -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);