This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients christian.heimes, jcea, mark.dickinson, petriborg, serhiy.storchaka, vstinner
Date 2015-03-27.09:59:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1427450366.75.0.989012338617.issue23786@psf.upfronthosting.co.za>
In-reply-to
Content
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];
+        double double_value;
     } block;
 
 #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);
History
Date User Action Args
2015-03-27 09:59:26serhiy.storchakasetrecipients: + serhiy.storchaka, jcea, mark.dickinson, vstinner, christian.heimes, petriborg
2015-03-27 09:59:26serhiy.storchakasetmessageid: <1427450366.75.0.989012338617.issue23786@psf.upfronthosting.co.za>
2015-03-27 09:59:26serhiy.storchakalinkissue23786 messages
2015-03-27 09:59:26serhiy.storchakacreate