OSDN Git Service

2000-09-06 Jeff Sturm <jeff.sturm@appnet.com>
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Sep 2000 22:25:56 +0000 (22:25 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Sep 2000 22:25:56 +0000 (22:25 +0000)
* include/jvm.h (_Jv_HashCode): Cast object ptr to `unsigned long'
to avoid long long division.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36215 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/include/jvm.h

index 66bec43..a7fa378 100644 (file)
@@ -1,3 +1,8 @@
+2000-09-06  Jeff Sturm  <jeff.sturm@appnet.com>
+
+       * include/jvm.h (_Jv_HashCode): Cast object ptr to `unsigned long'
+       to avoid long long division.
+
 2000-09-06  Tom Tromey  <tromey@cygnus.com>
 
        * java/lang/reflect/Constructor.java (toString): Use `getName' for
index 6517885..e6e6fa6 100644 (file)
@@ -164,8 +164,9 @@ inline jint
 _Jv_HashCode (jobject obj)
 {
   // This was chosen to yield relatively well distributed results on
-  // both 32- and 64-bit architectures.
-  return (jint) ((unsigned long long) obj % 0x7fffffff);
+  // both 32- and 64-bit architectures.  Note 0x7fffffff is prime.
+  // FIXME: we assume sizeof(long) == sizeof(void *).
+  return (jint) ((unsigned long) obj % 0x7fffffff);
 }
 
 // Return a raw pointer to the elements of an array given the array