summaryrefslogtreecommitdiff
path: root/numpy/core/include
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/include')
-rw-r--r--numpy/core/include/numpy/npy_common.h8
-rw-r--r--numpy/core/include/numpy/npy_cpu.h14
2 files changed, 10 insertions, 12 deletions
diff --git a/numpy/core/include/numpy/npy_common.h b/numpy/core/include/numpy/npy_common.h
index d5a586c56..c8495db8e 100644
--- a/numpy/core/include/numpy/npy_common.h
+++ b/numpy/core/include/numpy/npy_common.h
@@ -10,14 +10,6 @@
#include <npy_config.h>
#endif
-// int*, int64* should be propertly aligned on ARMv7 to avoid bus error
-#if !defined(NPY_STRONG_ALIGNMENT) && defined(__arm__) && !(defined(__aarch64__) || defined(_M_ARM64))
-#define NPY_STRONG_ALIGNMENT 1
-#endif
-#if !defined(NPY_STRONG_ALIGNMENT)
-#define NPY_STRONG_ALIGNMENT 0
-#endif
-
// compile time environment variables
#ifndef NPY_RELAXED_STRIDES_CHECKING
#define NPY_RELAXED_STRIDES_CHECKING 0
diff --git a/numpy/core/include/numpy/npy_cpu.h b/numpy/core/include/numpy/npy_cpu.h
index 4dbf9d84e..065176ac5 100644
--- a/numpy/core/include/numpy/npy_cpu.h
+++ b/numpy/core/include/numpy/npy_cpu.h
@@ -110,10 +110,16 @@
information about your platform (OS, CPU and compiler)
#endif
-#if (defined(NPY_CPU_X86) || defined(NPY_CPU_AMD64))
-#define NPY_CPU_HAVE_UNALIGNED_ACCESS 1
-#else
-#define NPY_CPU_HAVE_UNALIGNED_ACCESS 0
+/*
+ * Except for the following architectures, memory access is limited to the natural
+ * alignment of data types otherwise it may lead to bus error or performance regression.
+ * For more details about unaligned access, see https://www.kernel.org/doc/Documentation/unaligned-memory-access.txt.
+*/
+#if defined(NPY_CPU_X86) || defined(NPY_CPU_AMD64) || defined(__aarch64__) || defined(__powerpc64__)
+ #define NPY_ALIGNMENT_REQUIRED 0
+#endif
+#ifndef NPY_ALIGNMENT_REQUIRED
+ #define NPY_ALIGNMENT_REQUIRED 1
#endif
#endif