diff options
author | Mark Wiebe <mwwiebe@gmail.com> | 2011-01-01 23:58:41 -0800 |
---|---|---|
committer | Mark Wiebe <mwwiebe@gmail.com> | 2011-01-09 01:55:01 -0800 |
commit | 6f87e6ec6fd43e01af386874c0dea6489608986d (patch) | |
tree | 13b2593928d0d2dbce0816b037e6e253c0b3b8e6 /numpy | |
parent | f503ddb66decd2a9051b501c55a79da6be3a5a82 (diff) | |
download | numpy-6f87e6ec6fd43e01af386874c0dea6489608986d.tar.gz |
ENH: core: Change NPY_USE_UNALIGNED_ACCESS macro for low level loops
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 */ |