summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/src/multiarray/arraytypes.c.src7
-rw-r--r--numpy/core/src/multiarray/dtype_transfer.c14
-rw-r--r--numpy/core/src/multiarray/lowlevel_strided_loops.c.src12
3 files changed, 9 insertions, 24 deletions
diff --git a/numpy/core/src/multiarray/arraytypes.c.src b/numpy/core/src/multiarray/arraytypes.c.src
index 217a5ddaa..52b787975 100644
--- a/numpy/core/src/multiarray/arraytypes.c.src
+++ b/numpy/core/src/multiarray/arraytypes.c.src
@@ -3817,9 +3817,9 @@ NPY_NO_EXPORT PyArray_Descr @from@_Descr = {
/* type_num */
NPY_@from@,
/* elsize */
- @num@*sizeof(@fromtype@),
+ @num@ * sizeof(@fromtype@),
/* alignment */
- _ALIGN(@fromtype@),
+ @num@ * _ALIGN(@fromtype@),
/* subarray */
NULL,
/* fields */
@@ -4150,6 +4150,7 @@ set_typeinfo(PyObject *dict)
* CFLOAT, CDOUBLE, CLONGDOUBLE#
* #Name = Half, Float, Double, LongDouble,
* CFloat, CDouble, CLongDouble#
+ * #num = 1, 1, 1, 1, 2, 2, 2#
*/
PyDict_SetItemString(infodict, "@name@",
@@ -4160,7 +4161,7 @@ set_typeinfo(PyObject *dict)
#endif
NPY_@name@,
NPY_BITSOF_@name@,
- _ALIGN(@type@),
+ @num@ * _ALIGN(@type@),
(PyObject *) &Py@Name@ArrType_Type));
Py_DECREF(s);
diff --git a/numpy/core/src/multiarray/dtype_transfer.c b/numpy/core/src/multiarray/dtype_transfer.c
index e964bc265..93fef8495 100644
--- a/numpy/core/src/multiarray/dtype_transfer.c
+++ b/numpy/core/src/multiarray/dtype_transfer.c
@@ -3574,13 +3574,6 @@ PyArray_GetDTypeTransferFunction(int aligned,
PyArray_ISNBO(dst_dtype->byteorder)) {
if (PyArray_EquivTypenums(src_type_num, dst_type_num)) {
- /*
- * For complex numbers, the alignment is smaller than the
- * type size, so we turn off the aligned flag then.
- */
- if (src_dtype->kind == 'c' || dst_dtype->kind == 'c') {
- aligned = 0;
- }
*out_stransfer = PyArray_GetStridedCopyFn(aligned,
src_stride, dst_stride,
src_itemsize);
@@ -3677,13 +3670,6 @@ PyArray_GetDTypeTransferFunction(int aligned,
/* This is a straight copy */
if (src_itemsize == 1 || PyArray_ISNBO(src_dtype->byteorder) ==
PyArray_ISNBO(dst_dtype->byteorder)) {
- /*
- * For complex numbers, the alignment is smaller than the
- * type size, so we turn off the aligned flag then.
- */
- if (src_dtype->kind == 'c' || dst_dtype->kind == 'c') {
- aligned = 0;
- }
*out_stransfer = PyArray_GetStridedCopyFn(aligned,
src_stride, dst_stride,
src_itemsize);
diff --git a/numpy/core/src/multiarray/lowlevel_strided_loops.c.src b/numpy/core/src/multiarray/lowlevel_strided_loops.c.src
index 5c02c6e9f..b0770168f 100644
--- a/numpy/core/src/multiarray/lowlevel_strided_loops.c.src
+++ b/numpy/core/src/multiarray/lowlevel_strided_loops.c.src
@@ -21,12 +21,10 @@
#include "lowlevel_strided_loops.h"
/*
- * x86 platform may work with unaligned access, except when the
- * compiler uses aligned SSE instructions, which gcc does in some
- * cases. This is disabled for the time being.
+ * x86 platform works with unaligned access
*/
#if (defined(NPY_CPU_X86) || defined(NPY_CPU_AMD64))
-# define NPY_USE_UNALIGNED_ACCESS 0
+# define NPY_USE_UNALIGNED_ACCESS 1
#else
# define NPY_USE_UNALIGNED_ACCESS 0
#endif
@@ -534,7 +532,7 @@ NPY_NO_EXPORT PyArray_StridedUnaryOp *
/**end repeat1**/
}
- return &_strided_to_strided;
+ return &_swap@tag@_strided_to_strided;
}
else {
switch (itemsize) {
@@ -582,7 +580,7 @@ NPY_NO_EXPORT PyArray_StridedUnaryOp *
}
}
- return &_strided_to_strided;
+ return &_swap@tag@_strided_to_strided;
}
/* general dst */
else {
@@ -599,7 +597,7 @@ NPY_NO_EXPORT PyArray_StridedUnaryOp *
/**end repeat1**/
}
- return &_strided_to_strided;
+ return &_swap@tag@_strided_to_strided;
}
/* general src */
else {