@@ -282,7 +282,6 @@ quad_binary_op_resolve_descriptors(PyObject *self, PyArray_DTypeMeta *const dtyp
282
282
// Determine target backend and if casting is needed
283
283
NPY_CASTING casting = NPY_NO_CASTING;
284
284
if (descr_in1->backend != descr_in2->backend ) {
285
-
286
285
target_backend = BACKEND_LONGDOUBLE;
287
286
casting = NPY_SAFE_CASTING;
288
287
}
@@ -398,12 +397,11 @@ static int
398
397
quad_ufunc_promoter (PyUFuncObject *ufunc, PyArray_DTypeMeta *op_dtypes[],
399
398
PyArray_DTypeMeta *signature[], PyArray_DTypeMeta *new_op_dtypes[])
400
399
{
401
-
402
400
int nin = ufunc->nin ;
403
401
int nargs = ufunc->nargs ;
404
402
PyArray_DTypeMeta *common = NULL ;
405
403
bool has_quad = false ;
406
-
404
+
407
405
// Handle the special case for reductions
408
406
if (op_dtypes[0 ] == NULL ) {
409
407
assert (nin == 2 && ufunc->nout == 1 ); /* must be reduction */
@@ -417,7 +415,6 @@ quad_ufunc_promoter(PyUFuncObject *ufunc, PyArray_DTypeMeta *op_dtypes[],
417
415
// Check if any input or signature is QuadPrecision
418
416
for (int i = 0 ; i < nin; i++) {
419
417
if (op_dtypes[i] == &QuadPrecDType) {
420
-
421
418
has_quad = true ;
422
419
}
423
420
}
@@ -461,7 +458,7 @@ quad_ufunc_promoter(PyUFuncObject *ufunc, PyArray_DTypeMeta *op_dtypes[],
461
458
else {
462
459
// Otherwise, use the common dtype
463
460
Py_INCREF (common);
464
-
461
+
465
462
new_op_dtypes[i] = common;
466
463
}
467
464
}
@@ -563,13 +560,14 @@ init_quad_binary_ops(PyObject *numpy)
563
560
564
561
static NPY_CASTING
565
562
quad_comparison_op_resolve_descriptors (PyObject *self, PyArray_DTypeMeta *const dtypes[],
566
- PyArray_Descr *const given_descrs[],
567
- PyArray_Descr *loop_descrs[], npy_intp *NPY_UNUSED (view_offset))
563
+ PyArray_Descr *const given_descrs[],
564
+ PyArray_Descr *loop_descrs[],
565
+ npy_intp *NPY_UNUSED (view_offset))
568
566
{
569
567
QuadPrecDTypeObject *descr_in1 = (QuadPrecDTypeObject *)given_descrs[0 ];
570
568
QuadPrecDTypeObject *descr_in2 = (QuadPrecDTypeObject *)given_descrs[1 ];
571
569
QuadBackendType target_backend;
572
-
570
+
573
571
// As dealing with different backends then cast to boolean
574
572
NPY_CASTING casting = NPY_NO_CASTING;
575
573
if (descr_in1->backend != descr_in2->backend ) {
@@ -599,7 +597,7 @@ quad_comparison_op_resolve_descriptors(PyObject *self, PyArray_DTypeMeta *const
599
597
if (!loop_descrs[2 ]) {
600
598
return (NPY_CASTING)-1 ;
601
599
}
602
- return casting;
600
+ return casting;
603
601
}
604
602
605
603
template <cmp_quad_def sleef_comp, cmp_londouble_def ld_comp>
@@ -626,10 +624,9 @@ quad_generic_comp_strided_loop(PyArrayMethod_Context *context, char *const data[
626
624
npy_bool result;
627
625
628
626
if (backend == BACKEND_SLEEF) {
629
- result = sleef_comp (&in1.sleef_value , &in2.sleef_value );
627
+ result = sleef_comp (&in1.sleef_value , &in2.sleef_value );
630
628
}
631
629
else {
632
-
633
630
result = ld_comp (&in1.longdouble_value , &in2.longdouble_value );
634
631
}
635
632
@@ -642,12 +639,11 @@ quad_generic_comp_strided_loop(PyArrayMethod_Context *context, char *const data[
642
639
return 0 ;
643
640
}
644
641
645
-
646
642
template <cmp_quad_def sleef_comp, cmp_londouble_def ld_comp>
647
643
int
648
644
quad_generic_comp_strided_loop_aligned (PyArrayMethod_Context *context, char *const data[],
649
- npy_intp const dimensions[], npy_intp const strides[],
650
- NpyAuxData *auxdata)
645
+ npy_intp const dimensions[], npy_intp const strides[],
646
+ NpyAuxData *auxdata)
651
647
{
652
648
npy_intp N = dimensions[0 ];
653
649
char *in1_ptr = data[0 ], *in2_ptr = data[1 ];
@@ -658,19 +654,16 @@ quad_generic_comp_strided_loop_aligned(PyArrayMethod_Context *context, char *con
658
654
659
655
QuadPrecDTypeObject *descr = (QuadPrecDTypeObject *)context->descriptors [0 ];
660
656
QuadBackendType backend = descr->backend ;
661
- while (N--)
662
- {
657
+ while (N--) {
663
658
quad_value in1 = *(quad_value *)in1_ptr;
664
659
quad_value in2 = *(quad_value *)in2_ptr;
665
660
666
661
npy_bool result;
667
662
668
- if (backend == BACKEND_SLEEF)
669
- {
663
+ if (backend == BACKEND_SLEEF) {
670
664
result = sleef_comp (&in1.sleef_value , &in2.sleef_value );
671
- }
672
- else
673
- {
665
+ }
666
+ else {
674
667
result = ld_comp (&in1.longdouble_value , &in2.longdouble_value );
675
668
}
676
669
@@ -711,7 +704,8 @@ create_quad_comparison_ufunc(PyObject *numpy, const char *ufunc_name)
711
704
712
705
PyType_Slot slots[] = {
713
706
{NPY_METH_resolve_descriptors, (void *)&quad_comparison_op_resolve_descriptors},
714
- {NPY_METH_strided_loop, (void *)&quad_generic_comp_strided_loop_aligned<sleef_comp, ld_comp>},
707
+ {NPY_METH_strided_loop,
708
+ (void *)&quad_generic_comp_strided_loop_aligned<sleef_comp, ld_comp>},
715
709
{NPY_METH_unaligned_strided_loop,
716
710
(void *)&quad_generic_comp_strided_loop<sleef_comp, ld_comp>},
717
711
{0 , NULL }};
0 commit comments