Skip to content

Commit 633df7d

Browse files
committed
switch to system int
1 parent 31ec9d6 commit 633df7d

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

quaddtype/numpy_quaddtype/src/ops.hpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ quad_positive(const Sleef_quad *op)
2828
static inline Sleef_quad
2929
quad_sign(const Sleef_quad *op)
3030
{
31-
int32_t sign = Sleef_icmpq1(*op, QUAD_ZERO);
31+
int sign = Sleef_icmpq1(*op, QUAD_ZERO);
3232
// sign(x=NaN) = x; otherwise sign(x) in { -1.0; 0.0; +1.0 }
3333
return Sleef_iunordq1(*op, *op) ? *op : Sleef_cast_from_int64q1(sign);
3434
}
@@ -1048,14 +1048,14 @@ quad_spacing(const Sleef_quad *x)
10481048
}
10491049

10501050
// Mixed-type operations (quad, int32) -> quad
1051-
typedef Sleef_quad (*ldexp_op_quad_def)(const Sleef_quad *, const int32_t *);
1052-
typedef long double (*ldexp_op_longdouble_def)(const long double *, const int32_t *);
1051+
typedef Sleef_quad (*ldexp_op_quad_def)(const Sleef_quad *, const int *);
1052+
typedef long double (*ldexp_op_longdouble_def)(const long double *, const int *);
10531053

10541054
static inline Sleef_quad
1055-
quad_ldexp(const Sleef_quad *x, const int32_t *exp)
1055+
quad_ldexp(const Sleef_quad *x, const int *exp)
10561056
{
10571057
// ldexp(x, exp) returns x * 2^exp
1058-
// SLEEF expects: Sleef_quad, int32_t
1058+
// SLEEF expects: Sleef_quad, int
10591059

10601060
// NaN input -> NaN output (with sign preserved)
10611061
if (Sleef_iunordq1(*x, *x)) {
@@ -1072,14 +1072,13 @@ quad_ldexp(const Sleef_quad *x, const int32_t *exp)
10721072
return *x;
10731073
}
10741074

1075-
// Pass dereferenced values directly to SLEEF (no conversion needed)
10761075
Sleef_quad result = Sleef_ldexpq1(*x, *exp);
10771076

10781077
return result;
10791078
}
10801079

10811080
static inline long double
1082-
ld_ldexp(const long double *x, const int32_t *exp)
1081+
ld_ldexp(const long double *x, const int *exp)
10831082
{
10841083
// ldexp(x, exp) returns x * 2^exp
10851084
// stdlib ldexpl expects: long double, int
@@ -1099,7 +1098,6 @@ ld_ldexp(const long double *x, const int32_t *exp)
10991098
return *x;
11001099
}
11011100

1102-
// Cast int32_t to int for stdlib function
11031101
long double result = ldexpl(*x, *exp);
11041102

11051103
return result;

quaddtype/numpy_quaddtype/src/umath/binary_ops.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ quad_ldexp_resolve_descriptors(PyObject *self, PyArray_DTypeMeta *const dtypes[]
298298

299299
// Input 1: int (no need to incref, it's a builtin dtype)
300300
if (given_descrs[1] == NULL) {
301-
loop_descrs[1] = PyArray_DescrFromType(NPY_INT32);
301+
loop_descrs[1] = PyArray_DescrFromType(NPY_INT);
302302
} else {
303303
Py_INCREF(given_descrs[1]);
304304
loop_descrs[1] = given_descrs[1];
@@ -345,10 +345,10 @@ quad_ldexp_strided_loop_unaligned(PyArrayMethod_Context *context, char *const da
345345
size_t elem_size = (backend == BACKEND_SLEEF) ? sizeof(Sleef_quad) : sizeof(long double);
346346

347347
quad_value in1, out;
348-
int32_t in2;
348+
int in2;
349349
while (N--) {
350350
memcpy(&in1, in1_ptr, elem_size);
351-
memcpy(&in2, in2_ptr, sizeof(int32_t));
351+
memcpy(&in2, in2_ptr, sizeof(int));
352352
if (backend == BACKEND_SLEEF) {
353353
out.sleef_value = sleef_op(&in1.sleef_value, &in2);
354354
} else {
@@ -382,7 +382,7 @@ quad_ldexp_strided_loop_aligned(PyArrayMethod_Context *context, char *const data
382382
QuadBackendType backend = descr->backend;
383383

384384
while (N--) {
385-
int32_t *exp = (int32_t *)in2_ptr;
385+
int *exp = (int *)in2_ptr;
386386

387387
if (backend == BACKEND_SLEEF) {
388388
*(Sleef_quad *)out_ptr = sleef_op((Sleef_quad *)in1_ptr, exp);

0 commit comments

Comments
 (0)