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

ruby-changes:32458

From: usa <ko1@a...>
Date: Thu, 9 Jan 2014 20:34:24 +0900 (JST)
Subject: [ruby-changes:32458] usa:r44537 (trunk): * hash.c (rb_objid_hash): should return `long'. brushup r44534.

usa	2014-01-09 20:34:17 +0900 (Thu, 09 Jan 2014)

  New Revision: 44537

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

  Log:
    * hash.c (rb_objid_hash): should return `long'.  brushup r44534.
    
    * object.c (rb_obj_hash): follow above change.

  Modified files:
    trunk/ChangeLog
    trunk/hash.c
    trunk/object.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44536)
+++ ChangeLog	(revision 44537)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jan  9 20:31:10 2014  NAKAMURA Usaku  <usa@r...>
+
+	* hash.c (rb_objid_hash): should return `long'.  brushup r44534.
+
+	* object.c (rb_obj_hash): follow above change.
+
 Thu Jan  9 19:12:37 2014  Koichi Sasada  <ko1@a...>
 
 	* vm.c (rb_vm_pop_cfunc_frame): added.  It cares c_return event.
@@ -23,7 +29,8 @@ Thu Jan  9 19:12:37 2014  Koichi Sasada https://github.com/ruby/ruby/blob/trunk/ChangeLog#L29
 Thu Jan  9 17:40:28 2014  NAKAMURA Usaku  <usa@r...>
 
 	* hash.c (rb_any_hash): should treat the return value of rb_objid_hash()
-	  as `long', because ruby assumes the object id of an object is `long'.
+	  as `long', because ruby assumes the hash value of the object id of
+	  an object is `long'.
 	  this fixes test failures on mswin64 introduced at r44525.
 
 Thu Jan  9 09:55:20 2014  Aaron Patterson <aaron@t...>
Index: object.c
===================================================================
--- object.c	(revision 44536)
+++ object.c	(revision 44537)
@@ -161,7 +161,7 @@ rb_obj_equal(VALUE obj1, VALUE obj2) https://github.com/ruby/ruby/blob/trunk/object.c#L161
 VALUE
 rb_obj_hash(VALUE obj)
 {
-    st_index_t rb_objid_hash(st_index_t index);
+    long rb_objid_hash(st_index_t index);
     VALUE oid = rb_obj_id(obj);
 #if SIZEOF_LONG == SIZEOF_VOIDP
     st_index_t index = NUM2LONG(oid);
@@ -170,8 +170,7 @@ rb_obj_hash(VALUE obj) https://github.com/ruby/ruby/blob/trunk/object.c#L170
 #else
 # error not supported
 #endif
-    st_index_t h = rb_objid_hash(index);
-    return LONG2FIX(h);
+    return LONG2FIX(rb_objid_hash(index));
 }
 
 /*
Index: hash.c
===================================================================
--- hash.c	(revision 44536)
+++ hash.c	(revision 44537)
@@ -122,7 +122,7 @@ rb_hash(VALUE obj) https://github.com/ruby/ruby/blob/trunk/hash.c#L122
     return hval;
 }
 
-st_index_t rb_objid_hash(st_index_t index);
+long rb_objid_hash(st_index_t index);
 
 static st_index_t
 rb_any_hash(VALUE a)
@@ -132,8 +132,7 @@ rb_any_hash(VALUE a) https://github.com/ruby/ruby/blob/trunk/hash.c#L132
 
     if (SPECIAL_CONST_P(a)) {
 	if (a == Qundef) return 0;
-	/* assume hnum is long, so need to drop upper dword on LLP64. */
-	hnum = (long)rb_objid_hash((st_index_t)a);
+	hnum = rb_objid_hash((st_index_t)a);
     }
     else if (BUILTIN_TYPE(a) == T_STRING) {
 	hnum = rb_str_hash(a);
@@ -146,7 +145,7 @@ rb_any_hash(VALUE a) https://github.com/ruby/ruby/blob/trunk/hash.c#L145
     return (st_index_t)RSHIFT(hnum, 1);
 }
 
-st_index_t
+long
 rb_objid_hash(st_index_t index)
 {
     st_index_t hnum = rb_hash_start(index);

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

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