Replace pow with std::pow

The C pow casts to double while std::pow has overloads that can be
optimized by the compiler.
Also replace pow(*, 1./3) by cbrt.
This commit is contained in:
Vincent Rabaud
2026-01-04 01:50:00 +01:00
parent 10589eb2c8
commit 5622958189
47 changed files with 131 additions and 140 deletions

View File

@@ -397,7 +397,7 @@ struct MinkowskiDistance
diff1 = (ResultType)abs(a[1] - b[1]);
diff2 = (ResultType)abs(a[2] - b[2]);
diff3 = (ResultType)abs(a[3] - b[3]);
result += pow(diff0,order) + pow(diff1,order) + pow(diff2,order) + pow(diff3,order);
result += std::pow(diff0,order) + std::pow(diff1,order) + std::pow(diff2,order) + std::pow(diff3,order);
a += 4;
b += 4;
@@ -408,7 +408,7 @@ struct MinkowskiDistance
/* Process last 0-3 pixels. Not needed for standard vector lengths. */
while (a < last) {
diff0 = (ResultType)abs(*a++ - *b++);
result += pow(diff0,order);
result += std::pow(diff0,order);
}
return result;
}
@@ -419,7 +419,7 @@ struct MinkowskiDistance
template <typename U, typename V>
inline ResultType accum_dist(const U& a, const V& b, int) const
{
return pow(static_cast<ResultType>(abs(a-b)),order);
return std::pow(static_cast<ResultType>(abs(a-b)),order);
}
};