diff options
author | Christopher Whelan <topherwhelan@gmail.com> | 2019-03-28 22:47:32 -0700 |
---|---|---|
committer | Christopher Whelan <topherwhelan@gmail.com> | 2019-03-29 19:43:52 -0700 |
commit | 838abd75b5f3109e02c1834d15e47f0bc65e2129 (patch) | |
tree | c1bc00387bb7a3a982ba831d5cf8f12666b992d3 | |
parent | bea6946b607ec53d20f3cf82b0504a343285b45c (diff) | |
download | numpy-838abd75b5f3109e02c1834d15e47f0bc65e2129.tar.gz |
MAINT: remove OUTPUT_LOOP_FAST macro and use UNARY_LOOP_FAST instead
-rw-r--r-- | numpy/core/src/umath/fast_loop_macros.h | 25 | ||||
-rw-r--r-- | numpy/core/src/umath/loops.c.src | 12 |
2 files changed, 10 insertions, 27 deletions
diff --git a/numpy/core/src/umath/fast_loop_macros.h b/numpy/core/src/umath/fast_loop_macros.h index bab126b45..7a1ed66bc 100644 --- a/numpy/core/src/umath/fast_loop_macros.h +++ b/numpy/core/src/umath/fast_loop_macros.h @@ -85,31 +85,6 @@ steps[1] == 0 && \ steps[2] == sizeof(tout)) - -/* - * loop with contiguous specialization - * val should be the value to be stored in `tout *out` - * combine with NPY_GCC_OPT_3 to allow autovectorization - * should only be used where its worthwhile to avoid code bloat - */ -#define BASE_OUTPUT_LOOP(tout, val) \ - OUTPUT_LOOP { \ - tout *out = (tout *)op1; \ - *out = val; \ - } - -#define OUTPUT_LOOP_FAST(tout, val) \ - do { \ - /* condition allows compiler to optimize the generic macro */ \ - if (IS_OUTPUT_CONT(tout)) { \ - BASE_OUTPUT_LOOP(tout, val) \ - } \ - else { \ - BASE_OUTPUT_LOOP(tout, val) \ - } \ - } \ - while (0) - /* * loop with contiguous specialization * op should be the code working on `tin in` and diff --git a/numpy/core/src/umath/loops.c.src b/numpy/core/src/umath/loops.c.src index b7e28537a..abfd883f7 100644 --- a/numpy/core/src/umath/loops.c.src +++ b/numpy/core/src/umath/loops.c.src @@ -652,7 +652,11 @@ BOOL__ones_like(char **args, npy_intp *dimensions, npy_intp *steps, void *NPY_UN NPY_NO_EXPORT void BOOL_@kind@(char **args, npy_intp *dimensions, npy_intp *steps, void *NPY_UNUSED(func)) { - OUTPUT_LOOP_FAST(npy_bool, @val@); + /* + * The (void)in; suppresses an unused variable warning raised by gcc and allows + * us to re-use this macro even though we do not depend on in + */ + UNARY_LOOP_FAST(npy_bool, npy_bool, (void)in; *out = @val@); } /**end repeat**/ @@ -896,7 +900,11 @@ NPY_NO_EXPORT void NPY_NO_EXPORT void @TYPE@_@kind@(char **args, npy_intp *dimensions, npy_intp *steps, void *NPY_UNUSED(func)) { - OUTPUT_LOOP_FAST(npy_bool, @val@); + /* + * The (void)in; suppresses an unused variable warning raised by gcc and allows + * us to re-use this macro even though we do not depend on in + */ + UNARY_LOOP_FAST(@type@, npy_bool, (void)in; *out = @val@); } /**end repeat1**/ |