summaryrefslogtreecommitdiffstats
path: root/libjava/include
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-06 22:25:56 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-06 22:25:56 +0000
commit2904007dbf497020f4e4c5947de1dedd2b5ad475 (patch)
treeb99aa2a4bfca0a67e9f3c93722a69f549c244c8a /libjava/include
parent905a13efdff2c485d951909aee75da7f5d9527c2 (diff)
downloadppe42-gcc-2904007dbf497020f4e4c5947de1dedd2b5ad475.tar.gz
ppe42-gcc-2904007dbf497020f4e4c5947de1dedd2b5ad475.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36215 138bc75d-0d04-0410-961f-82ee72b054a4
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 65178851085..e6e6fa6e4aa 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
OpenPOWER on IntegriCloud