diff options
author | Mark Wiebe <mwwiebe@gmail.com> | 2011-08-07 15:11:37 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2011-08-27 07:26:53 -0600 |
commit | d5ef96136874f9e3f475833ca5f966e9599b2223 (patch) | |
tree | 2ae16228bbb69980005db9a6ba65224c662bf1f6 /numpy | |
parent | c1ebc154bf4f9d41f28543483a902adfe347f9a3 (diff) | |
download | numpy-d5ef96136874f9e3f475833ca5f966e9599b2223.tar.gz |
ENH: core: Make 1-byte low level loops use memset
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/lowlevel_strided_loops.c.src | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/numpy/core/src/multiarray/lowlevel_strided_loops.c.src b/numpy/core/src/multiarray/lowlevel_strided_loops.c.src index 82cf49ea2..ec2173daf 100644 --- a/numpy/core/src/multiarray/lowlevel_strided_loops.c.src +++ b/numpy/core/src/multiarray/lowlevel_strided_loops.c.src @@ -188,9 +188,13 @@ static void npy_intp N, npy_intp NPY_UNUSED(src_itemsize), NpyAuxData *NPY_UNUSED(data)) { -#if @elsize@ != 16 - @type@ temp = @swap@@elsize@(*((@type@ *)src)); +#if @elsize@ == 1 && @dst_contig@ + memset(dst, *src, N); #else + +# if @elsize@ != 16 + @type@ temp = @swap@@elsize@(*((@type@ *)src)); +# else npy_uint64 temp0, temp1; # if @is_swap@ == 0 temp0 = (*((npy_uint64 *)src)); @@ -202,24 +206,25 @@ static void temp0 = _NPY_SWAP8(*((npy_uint64 *)src)); temp1 = _NPY_SWAP8(*((npy_uint64 *)src + 1)); # endif -#endif +# endif while (N > 0) { -#if @elsize@ != 16 +# if @elsize@ != 16 *((@type@ *)dst) = temp; -#else +# else *((npy_uint64 *)dst) = temp0; *((npy_uint64 *)dst + 1) = temp1; -#endif -#if @dst_contig@ +# endif +# if @dst_contig@ dst += @elsize@; -#else +# else dst += dst_stride; -#endif +# endif --N; } +#endif/* @elsize == 1 && @dst_contig@ -- else */ } -#endif +#endif/* (@src_contig@ == 0) && @is_aligned@ */ #endif/* @elsize@ >= @minelsize@ */ |