Commit 5e60b570 by Ian Lance Taylor

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
parent dbe1e4a5
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <stddef.h> #include <stddef.h>
#include "config.h"
#include "go-type.h" #include "go-type.h"
/* The 64-bit type. */ /* The 64-bit type. */
...@@ -31,7 +32,11 @@ __go_type_hash_identity (const void *key, uintptr_t key_size) ...@@ -31,7 +32,11 @@ __go_type_hash_identity (const void *key, uintptr_t key_size)
unsigned char a[8]; unsigned char a[8];
} u; } u;
u.v = 0; 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) if (sizeof (uintptr_t) >= 8)
return (uintptr_t) u.v; return (uintptr_t) u.v;
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment