summaryrefslogtreecommitdiff
path: root/Objects/obmalloc.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-05-25 10:18:34 -0700
committerGitHub <noreply@github.com>2019-05-25 10:18:34 -0700
commit1b85f4ec45a5d63188ee3866bd55eb29fdec7fbf (patch)
tree5f69cce0e94396277c4ef25628fdd987b567641e /Objects/obmalloc.c
parent2156fec1f7a8f9972e90cdbaf404e3fd9eaccb35 (diff)
downloadcpython-git-1b85f4ec45a5d63188ee3866bd55eb29fdec7fbf.tar.gz
bpo-27987: pymalloc: align by 16bytes on 64bit platform (GH-12850)
(cherry picked from commit f0be4bbb9b3cee876249c23f2ae6f38f43fa7495) Co-authored-by: Inada Naoki <songofacandy@gmail.com>
Diffstat (limited to 'Objects/obmalloc.c')
-rw-r--r--Objects/obmalloc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
index 46e84270b2..885ad537ad 100644
--- a/Objects/obmalloc.c
+++ b/Objects/obmalloc.c
@@ -788,8 +788,14 @@ static int running_on_valgrind = -1;
*
* You shouldn't change this unless you know what you are doing.
*/
+
+#if SIZEOF_VOID_P > 4
+#define ALIGNMENT 16 /* must be 2^N */
+#define ALIGNMENT_SHIFT 4
+#else
#define ALIGNMENT 8 /* must be 2^N */
#define ALIGNMENT_SHIFT 3
+#endif
/* Return the number of bytes in size class I, as a uint. */
#define INDEX2SIZE(I) (((uint)(I) + 1) << ALIGNMENT_SHIFT)