diff options
Diffstat (limited to 'numpy/core/src/arrayobject.c')
-rw-r--r-- | numpy/core/src/arrayobject.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index e02cff92e..c774ae5a2 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -1378,13 +1378,13 @@ PyArray_Scalar(void *data, PyArray_Descr *descr, PyObject *base) byte_swap_vector(destptr, length, 4); #else /* need aligned data buffer */ - if ((((intp)data) % descr->alignment) != 0) { + if ((swap) || ((((intp)data) % descr->alignment) != 0)) { buffer = _pya_malloc(itemsize); if (buffer == NULL) return PyErr_NoMemory(); alloc = 1; memcpy(buffer, data, itemsize); - if (!PyArray_ISNOTSWAPPED(base)) { + if (swap) { byte_swap_vector(buffer, itemsize >> 2, 4); } |