Message 239384 - Python tracker (original) (raw)
What if add double field in the block union? (And may be compile with -munaligned-doubles)
diff -r a417d89fbc38 Python/pyhash.c --- a/Python/pyhash.c Thu Mar 26 09:37:23 2015 +0100 +++ b/Python/pyhash.c Fri Mar 27 11:52:25 2015 +0200 @@ -247,6 +247,7 @@ fnv(const void *src, Py_ssize_t len) union { Py_uhash_t value; unsigned char bytes[SIZEOF_PY_UHASH_T];
} block;double double_value;
#ifdef Py_DEBUG
What if add the aligned attribute?
diff -r a417d89fbc38 Python/pyhash.c --- a/Python/pyhash.c Thu Mar 26 09:37:23 2015 +0100 +++ b/Python/pyhash.c Fri Mar 27 11:58:30 2015 +0200 @@ -247,7 +247,7 @@ fnv(const void *src, Py_ssize_t len) union { Py_uhash_t value; unsigned char bytes[SIZEOF_PY_UHASH_T];
- } block;
- } block attribute ((aligned(SIZEOF_PY_UHASH_T)));
#ifdef Py_DEBUG assert(_Py_HashSecret_Initialized);