runtime: Better big-endian identity hash function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184914
138bc75d-0d04-0410-961f-
82ee72b054a4
#include <stddef.h>
+#include "config.h"
#include "go-type.h"
/* The 64-bit type. */
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