aboutsummaryrefslogtreecommitdiff
path: root/libjava/include
diff options
context:
space:
mode:
authorJeff Sturm <jeff.sturm@appnet.com>2000-09-06 22:25:56 +0000
committerTom Tromey <tromey@gcc.gnu.org>2000-09-06 22:25:56 +0000
commit26aa75bef97454f65b437067cf77a5a0255934a3 (patch)
treeb99aa2a4bfca0a67e9f3c93722a69f549c244c8a /libjava/include
parent9579ea7efd6705df231ba165da90c73dcb43d4cb (diff)
downloadgcc-26aa75bef97454f65b437067cf77a5a0255934a3.zip
gcc-26aa75bef97454f65b437067cf77a5a0255934a3.tar.gz
gcc-26aa75bef97454f65b437067cf77a5a0255934a3.tar.bz2
jvm.h (_Jv_HashCode): Cast object ptr to `unsigned long' to avoid long long division.
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
Diffstat (limited to 'libjava/include')
-rw-r--r--libjava/include/jvm.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h
index 6517885..e6e6fa6 100644
--- a/libjava/include/jvm.h
+++ b/libjava/include/jvm.h
@@ -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