From 5e60b5708e2184c7ca0cb5bab995248d185a7bac Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 5 Mar 2012 06:39:08 +0000 Subject: [PATCH] re PR go/52342 (64-bit go.test/test/chan/doubleselect.go times out on Solaris/SPARC) PR go/52342 runtime: Better big-endian identity hash function. From-SVN: r184914 --- libgo/runtime/go-type-identity.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 +#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