@@ -26,6 +26,18 @@ quad_to_quad_resolve_descriptors(PyObject *NPY_UNUSED(self),
26
26
PyArray_Descr * given_descrs [2 ], PyArray_Descr * loop_descrs [2 ],
27
27
npy_intp * view_offset )
28
28
{
29
+ Py_INCREF (given_descrs [0 ]);
30
+ loop_descrs [0 ] = given_descrs [0 ];
31
+
32
+ if (given_descrs [1 ] == NULL ) {
33
+ Py_INCREF (given_descrs [0 ]);
34
+ loop_descrs [1 ] = given_descrs [0 ];
35
+ }
36
+ else {
37
+ Py_INCREF (given_descrs [1 ]);
38
+ loop_descrs [1 ] = given_descrs [1 ];
39
+ }
40
+
29
41
return NPY_SAME_KIND_CASTING ;
30
42
}
31
43
@@ -140,69 +152,3 @@ PyArrayMethod_Spec QuadToQuadCastSpec = {
140
152
.dtypes = QuadToQuadDtypes ,
141
153
.slots = QuadToQuadSlots ,
142
154
};
143
-
144
- // Quad to Float128
145
- static NPY_CASTING
146
- quad_to_float128_resolve_descriptors (PyObject * NPY_UNUSED (self ),
147
- PyArray_DTypeMeta * NPY_UNUSED (dtypes [2 ]),
148
- PyArray_Descr * given_descrs [2 ], PyArray_Descr * loop_descrs [2 ],
149
- npy_intp * view_offset )
150
- {
151
- return NPY_SAME_KIND_CASTING ;
152
- }
153
-
154
- static int
155
- quad_to_float128_contiguous (PyArrayMethod_Context * NPY_UNUSED (context ), char * const data [],
156
- npy_intp const dimensions [], npy_intp const strides [], void * auxdata )
157
- {
158
- return 0 ;
159
- }
160
-
161
- static int
162
- quad_to_float128_strided (PyArrayMethod_Context * NPY_UNUSED (context ), char * const data [],
163
- npy_intp const dimensions [], npy_intp const strides [], void * auxdata )
164
- {
165
- return 0 ;
166
- }
167
-
168
- static int
169
- quad_to_float128_unaligned (PyArrayMethod_Context * NPY_UNUSED (context ), char * const data [],
170
- npy_intp const dimensions [], npy_intp const strides [], void * auxdata )
171
- {
172
- return 0 ;
173
- }
174
-
175
- static int
176
- quad_to_float128_get_loop (PyArrayMethod_Context * context , int aligned ,
177
- int NPY_UNUSED (move_references ), const npy_intp * strides ,
178
- PyArrayMethod_StridedLoop * * out_loop , NpyAuxData * * out_transferdata ,
179
- NPY_ARRAYMETHOD_FLAGS * flags )
180
- {
181
- int contig = (strides [0 ] == sizeof (__float128 ) && strides [1 ] == sizeof (__float128 ));
182
-
183
- if (aligned && contig )
184
- * out_loop = (PyArrayMethod_StridedLoop * )& quad_to_float128_contiguous ;
185
- else if (aligned )
186
- * out_loop = (PyArrayMethod_StridedLoop * )& quad_to_float128_strided ;
187
- else
188
- * out_loop = (PyArrayMethod_StridedLoop * )& quad_to_float128_unaligned ;
189
-
190
- * flags = 0 ;
191
- return 0 ;
192
- }
193
-
194
- static PyArray_DTypeMeta * QuadToFloat128Dtypes [2 ] = {NULL , NULL };
195
- static PyType_Slot QuadToFloat128Slots [] = {
196
- {NPY_METH_resolve_descriptors , & quad_to_float128_resolve_descriptors },
197
- {_NPY_METH_get_loop , & quad_to_float128_get_loop },
198
- {0 , NULL }};
199
-
200
- PyArrayMethod_Spec QuadToFloat128CastSpec = {
201
- .name = "cast_QuadDType_to_Float128" ,
202
- .nin = 1 ,
203
- .nout = 1 ,
204
- .flags = NPY_METH_SUPPORTS_UNALIGNED ,
205
- .casting = NPY_SAFE_CASTING ,
206
- .dtypes = QuadToFloat128Dtypes ,
207
- .slots = QuadToFloat128Slots ,
208
- };
0 commit comments