[前][次][番号順一覧][スレッド一覧]

ruby-changes:14488

From: nobu <ko1@a...>
Date: Thu, 14 Jan 2010 13:07:15 +0900 (JST)
Subject: [ruby-changes:14488] Ruby:r26325 (trunk): * numeric.c (flo_hash, int_chr): fixed type.

nobu	2010-01-14 13:07:00 +0900 (Thu, 14 Jan 2010)

  New Revision: 26325

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26325

  Log:
    * numeric.c (flo_hash, int_chr): fixed type.

  Modified files:
    trunk/ChangeLog
    trunk/numeric.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 26324)
+++ ChangeLog	(revision 26325)
@@ -1,3 +1,7 @@
+Thu Jan 14 13:06:58 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* numeric.c (flo_hash, int_chr): fixed type.
+
 Thu Jan 14 12:50:37 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* string.c (rb_str_concat): fixed range check for Fixnum, and
Index: numeric.c
===================================================================
--- numeric.c	(revision 26324)
+++ numeric.c	(revision 26325)
@@ -566,7 +566,7 @@
 
     if (isinf(value))
 	return rb_usascii_str_new2(value < 0 ? "-Infinity" : "Infinity");
-    else if(isnan(value))
+    else if (isnan(value))
 	return rb_usascii_str_new2("NaN");
 
 # define FLOFMT(buf, size, fmt, prec, val) snprintf(buf, size, fmt, prec, val), \
@@ -956,7 +956,7 @@
     /* normalize -0.0 to 0.0 */
     if (d == 0.0) d = 0.0;
     hash = rb_memhash(&d, sizeof(d));
-    return INT2FIX(hash);
+    return LONG2FIX(hash);
 }
 
 VALUE
@@ -1975,7 +1975,7 @@
 {
     char c;
     int n;
-    long i = NUM2LONG(num);
+    SIGNED_VALUE i = NUM2LONG(num);
     rb_encoding *enc;
     VALUE str;
 
@@ -2006,8 +2006,8 @@
     enc = rb_to_encoding(argv[0]);
     if (!enc) enc = rb_ascii8bit_encoding();
   decode:
-#if SIZEOF_INT < SIZEOF_LONG
-    if (i > INT_MAX) goto out_of_range;
+#if SIZEOF_INT < SIZEOF_VALUE
+    if (i > UINT_MAX) goto out_of_range;
 #endif
     if (i < 0 || (n = rb_enc_codelen((int)i, enc)) <= 0) goto out_of_range;
     str = rb_enc_str_new(0, n, enc);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]