diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-05 06:39:08 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-05 06:39:08 +0000 |
commit | e882d6d440b359510b481d55f72b28a30e50b1fe (patch) | |
tree | da22a7e051bf39bc7d2f04bf8bae6456b8b0f3df /libgo | |
parent | d1b5e112548db5fbd80c354df63fe4412ab69c80 (diff) | |
download | gcc-e882d6d440b359510b481d55f72b28a30e50b1fe.tar.gz |
PR go/52342
runtime: Better big-endian identity hash function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184914 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/runtime/go-type-identity.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libgo/runtime/go-type-identity.c b/libgo/runtime/go-type-identity.c index 142edf42464..a50a8a131a1 100644 --- a/libgo/runtime/go-type-identity.c +++ b/libgo/runtime/go-type-identity.c @@ -6,6 +6,7 @@ #include <stddef.h> +#include "config.h" #include "go-type.h" /* The 64-bit type. */ @@ -31,7 +32,11 @@ __go_type_hash_identity (const void *key, uintptr_t key_size) unsigned char a[8]; } u; u.v = 0; - __builtin_memcpy (&u.a, key, key_size); +#ifdef WORDS_BIGENDIAN + __builtin_memcpy (&u.a[8 - key_size], key, key_size); +#else + __builtin_memcpy (&u.a[0], key, key_size); +#endif if (sizeof (uintptr_t) >= 8) return (uintptr_t) u.v; else |