diff options
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/lowlevel_strided_loops.c.src | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/numpy/core/src/multiarray/lowlevel_strided_loops.c.src b/numpy/core/src/multiarray/lowlevel_strided_loops.c.src index 06f44d23f..880659f2a 100644 --- a/numpy/core/src/multiarray/lowlevel_strided_loops.c.src +++ b/numpy/core/src/multiarray/lowlevel_strided_loops.c.src @@ -14,8 +14,11 @@ #include "lowlevel_strided_loops.h" -#if ! (defined(NPY_CPU_X86) || defined(NPY_CPU_AMD64)) -//# define NPY_USE_UNALIGNED_ACCESS +/* x86 platform works with unaligned reads and writes */ +#if (defined(NPY_CPU_X86) || defined(NPY_CPU_AMD64)) +# define NPY_USE_UNALIGNED_ACCESS 1 +#else +# define NPY_USE_UNALIGNED_ACCESS 0 #endif #define _NPY_NOP1(x) (x) @@ -105,7 +108,7 @@ #if (@elsize@ >= @minelsize@) && \ (@elsize@ > 1 || @is_aligned@) && \ - (!defined(NPY_USE_UNALIGNED_ACCESS) || @is_aligned@) + (!NPY_USE_UNALIGNED_ACCESS || @is_aligned@) #if @is_swap@ || @src_contig@ == 0 || @dst_contig@ == 0 @@ -333,7 +336,7 @@ PyArray_GetStridedCopyFn(npy_intp aligned, npy_intp src_stride, * Skip the "unaligned" versions on CPUs which support unaligned * memory accesses. */ -#ifndef NPY_USE_UNALIGNED_ACCESS +#if !NPY_USE_UNALIGNED_ACCESS if (aligned) { #endif/*!NPY_USE_UNALIGNED_ACCESS*/ @@ -408,7 +411,7 @@ PyArray_GetStridedCopyFn(npy_intp aligned, npy_intp src_stride, } } -#ifndef NPY_USE_UNALIGNED_ACCESS +#if !NPY_USE_UNALIGNED_ACCESS } else { /* contiguous dst */ @@ -488,7 +491,7 @@ NPY_NO_EXPORT PyArray_StridedTransferFn * Skip the "unaligned" versions on CPUs which support unaligned * memory accesses. */ -#ifndef NPY_USE_UNALIGNED_ACCESS +#if !NPY_USE_UNALIGNED_ACCESS if (aligned) { #endif/*!NPY_USE_UNALIGNED_ACCESS*/ @@ -580,7 +583,7 @@ NPY_NO_EXPORT PyArray_StridedTransferFn } } -#ifndef NPY_USE_UNALIGNED_ACCESS +#if !NPY_USE_UNALIGNED_ACCESS } else { /* contiguous dst */ |