Skip to content

Commit b7fa1ee

Browse files
committed
Deprecate math macros
We can simply use the functions from `<math.h>` instead of conditionally relying on GCC and Clang's `__builtin_*` functions. The likely reason for commit 90c1fb9 was due to https://sourceware.org/bugzilla/show_bug.cgi?id=17441, which was resolved in glibc 2.23.
1 parent df54c2b commit b7fa1ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+149
-150
lines changed

libvips/arithmetic/abs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ vips_abs_build(VipsObject *object)
116116
int x; \
117117
\
118118
for (x = 0; x < sz; x++) \
119-
q[x] = VIPS_FABS(p[x]); \
119+
q[x] = fabs(p[x]); \
120120
}
121121

122122
/* Complex abs operation: calculate modulus.

libvips/arithmetic/deviate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ vips_deviate_build(VipsObject *object)
120120
s2 = deviate->sum2;
121121

122122
g_object_set(object,
123-
"out", sqrt(VIPS_FABS(s2 - (s * s / vals)) / (vals - 1)),
123+
"out", sqrt(fabs(s2 - (s * s / vals)) / (vals - 1)),
124124
NULL);
125125

126126
return 0;

libvips/arithmetic/divide.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ G_DEFINE_TYPE(VipsDivide, vips_divide, VIPS_TYPE_BINARY);
9797
q[0] = 0.0; \
9898
q[1] = 0.0; \
9999
} \
100-
else if (VIPS_FABS(right[0]) > VIPS_FABS(right[1])) { \
100+
else if (fabs(right[0]) > fabs(right[1])) { \
101101
double a = right[1] / right[0]; \
102102
double b = right[0] + right[1] * a; \
103103
\

libvips/arithmetic/max.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ vips_max_stop(VipsStatistic *statistic, void *seq)
337337
TYPE m; \
338338
\
339339
for (i = 0; i < sz && values->n < values->size; i++) \
340-
if (!VIPS_ISNAN(p[i])) \
340+
if (!isnan(p[i])) \
341341
vips_values_add(values, p[i], x + i / bands, y); \
342342
m = values->value[0]; \
343343
\
@@ -358,7 +358,7 @@ vips_max_stop(VipsStatistic *statistic, void *seq)
358358
for (i = 0; i < sz && values->n < values->size; i++) { \
359359
TYPE mod2 = p[0] * p[0] + p[1] * p[1]; \
360360
\
361-
if (!VIPS_ISNAN(mod2)) \
361+
if (!isnan(mod2)) \
362362
vips_values_add(values, p[i], x + i / bands, y); \
363363
\
364364
p += 2; \

libvips/arithmetic/maxpair.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ G_DEFINE_TYPE(VipsMaxpair, vips_maxpair, VIPS_TYPE_BINARY);
7070
TYPE *restrict q = (TYPE *) out; \
7171
\
7272
for (int x = 0; x < sz; x++) \
73-
q[x] = VIPS_FMAX(left[x], right[x]); \
73+
q[x] = fmax(left[x], right[x]); \
7474
}
7575

7676
static void

libvips/arithmetic/measure.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ vips_measure_build(VipsObject *object)
159159
* averages near zero (can get these if use
160160
* measure on IM_TYPE_LAB images).
161161
*/
162-
if (dev * 5 > VIPS_FABS(avg) &&
163-
VIPS_FABS(avg) > 3)
162+
if (dev * 5 > fabs(avg) &&
163+
fabs(avg) > 3)
164164
g_warning(_("%s: "
165165
"patch %d x %d, "
166166
"band %d: "

libvips/arithmetic/min.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ vips_min_stop(VipsStatistic *statistic, void *seq)
337337
TYPE m; \
338338
\
339339
for (i = 0; i < sz && values->n < values->size; i++) \
340-
if (!VIPS_ISNAN(p[i])) \
340+
if (!isnan(p[i])) \
341341
vips_values_add(values, p[i], x + i / bands, y); \
342342
m = values->value[0]; \
343343
\
@@ -358,7 +358,7 @@ vips_min_stop(VipsStatistic *statistic, void *seq)
358358
for (i = 0; i < sz && values->n < values->size; i++) { \
359359
TYPE mod2 = p[0] * p[0] + p[1] * p[1]; \
360360
\
361-
if (!VIPS_ISNAN(mod2)) \
361+
if (!isnan(mod2)) \
362362
vips_values_add(values, p[i], x + i / bands, y); \
363363
\
364364
p += 2; \

libvips/arithmetic/minpair.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ G_DEFINE_TYPE(VipsMinpair, vips_minpair, VIPS_TYPE_BINARY);
7070
TYPE *restrict q = (TYPE *) out; \
7171
\
7272
for (int x = 0; x < sz; x++) \
73-
q[x] = VIPS_FMIN(left[x], right[x]); \
73+
q[x] = fmin(left[x], right[x]); \
7474
}
7575

7676
static void

libvips/arithmetic/remainder.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ vips_remainder_build(VipsObject *object)
113113
double a = p1[x]; \
114114
double b = p2[x]; \
115115
\
116-
q[x] = b ? a - b * VIPS_FLOOR(a / b) : -1; \
116+
q[x] = b ? a - b * floor(a / b) : -1; \
117117
} \
118118
}
119119

libvips/arithmetic/round.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@ vips_round_buffer(VipsArithmetic *arithmetic,
127127

128128
switch (round->round) {
129129
case VIPS_OPERATION_ROUND_RINT:
130-
SWITCH(VIPS_RINT);
130+
SWITCH(rint);
131131
break;
132132
case VIPS_OPERATION_ROUND_CEIL:
133-
SWITCH(VIPS_CEIL);
133+
SWITCH(ceil);
134134
break;
135135
case VIPS_OPERATION_ROUND_FLOOR:
136-
SWITCH(VIPS_FLOOR);
136+
SWITCH(floor);
137137
break;
138138

139139
default:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy