diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2018-12-26 09:03:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-26 09:03:59 -0700 |
commit | 65709ebb9954f9764dc6622a2606e624acb1e362 (patch) | |
tree | 29fac5f4447599c935282a5b5c21dc2ec484497e /numpy/core/src | |
parent | 3d7e90c21f64e8905585c1e25f4fe64934171e7f (diff) | |
parent | de4c4ef7e8a828331694de290582dced09c4df6f (diff) | |
download | numpy-65709ebb9954f9764dc6622a2606e624acb1e362.tar.gz |
Merge pull request #12611 from mattip/align-longdouble
BUG: longdouble with elsize 12 is never uint alignable
Diffstat (limited to 'numpy/core/src')
-rw-r--r-- | numpy/core/src/common/array_assign.c | 6 | ||||
-rw-r--r-- | numpy/core/src/common/array_assign.h | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/numpy/core/src/common/array_assign.c b/numpy/core/src/common/array_assign.c index ac3fdbef7..02a423e3a 100644 --- a/numpy/core/src/common/array_assign.c +++ b/numpy/core/src/common/array_assign.c @@ -125,9 +125,13 @@ raw_array_is_aligned(int ndim, npy_intp *shape, return npy_is_aligned((void *)align_check, alignment); } - else { + else if (alignment == 1) { return 1; } + else { + /* always return false for alignment == 0, which means cannot-be-aligned */ + return 0; + } } NPY_NO_EXPORT int diff --git a/numpy/core/src/common/array_assign.h b/numpy/core/src/common/array_assign.h index 07438c5e8..69ef56bb4 100644 --- a/numpy/core/src/common/array_assign.h +++ b/numpy/core/src/common/array_assign.h @@ -87,8 +87,10 @@ broadcast_strides(int ndim, npy_intp *shape, /* * Checks whether a data pointer + set of strides refers to a raw - * array whose elements are all aligned to a given alignment. - * alignment should be a power of two. + * array whose elements are all aligned to a given alignment. Returns + * 1 if data is aligned to alignment or 0 if not. + * alignment should be a power of two, or may be the sentinel value 0 to mean + * cannot-be-aligned, in which case 0 (false) is always returned. */ NPY_NO_EXPORT int raw_array_is_aligned(int ndim, npy_intp *shape, |