]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
jvm.h (_Jv_HashCode): Cast object ptr to `unsigned long' to avoid long long division.
authorJeff Sturm <jeff.sturm@appnet.com>
Wed, 6 Sep 2000 22:25:56 +0000 (22:25 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Wed, 6 Sep 2000 22:25:56 +0000 (22:25 +0000)
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.

From-SVN: r36215

libjava/ChangeLog
libjava/include/jvm.h

index 66bec434ead18a86ef96aa5ce4c1ab0a76b09ad3..a7fa378e12a6c4635f895c3bbf2c2eeade46bdd0 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 65178851085cc4a6595c07b9b2e44af61e6c399b..e6e6fa6e4aafa6329a60605d2ef0b433662bea9d 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