8000 BUG: reduce maximum alignment to 8 bytes on 32 bit · numpy/numpy@7d106d5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7d106d5

Browse files
committed
BUG: reduce maximum alignment to 8 bytes on 32 bit
malloc only provides 8byte alignment and is sufficient to load complex on x86 platforms. This fixes the f2py alignment failures with complex types on win32 or on linux32 with -malign-double
1 parent 3351dbf commit 7d106d5

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

numpy/core/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,7 @@ def generate_multiarray_templated_sources(ext, build_dir):
764764
join('src', 'multiarray', 'ucsnarrow.h'),
765765
join('src', 'multiarray', 'usertypes.h'),
766766
join('src', 'multiarray', 'vdot.h'),
767+
join('src', 'private', 'npy_config.h'),
767768
join('src', 'private', 'templ_common.h.src'),
768769
join('src', 'private', 'lowlevel_strided_loops.h'),
769770
join('include', 'numpy', 'arrayobject.h'),

numpy/core/src/private/npy_config.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "config.h"
55
#include "numpy/numpyconfig.h"
6+
#include "numpy/npy_cpu.h"
67

78
/* Disable broken MS math functions */
89
#if defined(_MSC_VER) || defined(__MINGW32_VERSION)
@@ -19,7 +20,11 @@
1920
* amd64 is not harmed much by the bloat as the system provides 16 byte
2021
* alignment by default.
2122
*/
23+
#if (defined NPY_CPU_X86 || defined _WIN32)
24+
#define NPY_MAX_COPY_ALIGNMENT 8
25+
#else
2226
#define NPY_MAX_COPY_ALIGNMENT 16
27+
#endif
2328

2429
/* Disable broken Sun Workshop Pro math functions */
2530
#ifdef __SUNPRO_C

0 commit comments

Comments
 (0)
0