Bug 1930660 Part 2 - Replace remaining uses of mozilla::clamped by std::clamp r=jwatt,emilio

Differential Revision: https://phabricator.services.mozilla.com/D228668
This commit is contained in:
longsonr 2024-11-13 14:04:29 +00:00
parent 55728763ac
commit bb7cc131bc
3 changed files with 3 additions and 26 deletions

View File

@ -122,9 +122,8 @@ void HRTFDatabase::getKernelsFromAzimuthElevation(
unsigned HRTFDatabase::indexFromElevationAngle(double elevationAngle) {
// Clamp to allowed range.
elevationAngle =
mozilla::clamped(elevationAngle, static_cast<double>(MinElevation),
static_cast<double>(MaxElevation));
elevationAngle = std::clamp(elevationAngle, static_cast<double>(MinElevation),
static_cast<double>(MaxElevation));
unsigned elevationIndex =
static_cast<int>(InterpolationFactor * (elevationAngle - MinElevation) /

View File

@ -90,7 +90,7 @@ nsReturnRef<HRTFKernel> HRTFKernel::createInterpolatedKernel(
if (!kernel1 || !kernel2) return nsReturnRef<HRTFKernel>();
MOZ_ASSERT(x >= 0.0 && x < 1.0);
x = mozilla::clamped(x, 0.0f, 1.0f);
x = std::clamp(x, 0.0f, 1.0f);
float sampleRate1 = kernel1->sampleRate();
float sampleRate2 = kernel2->sampleRate();

View File

@ -29,26 +29,4 @@ inline const T& XPCOM_MAX(const T& aA, const T& aB) {
return aA > aB ? aA : aB;
}
namespace mozilla {
template <class T>
inline const T& clamped(const T& aA, const T& aMin, const T& aMax) {
MOZ_ASSERT(aMax >= aMin,
"clamped(): aMax must be greater than or equal to aMin");
return XPCOM_MIN(XPCOM_MAX(aA, aMin), aMax);
}
} // namespace mozilla
template <class InputIterator, class T>
inline uint32_t NS_COUNT(InputIterator& aFirst, const InputIterator& aLast,
const T& aValue) {
uint32_t result = 0;
for (; aFirst != aLast; ++aFirst)
if (*aFirst == aValue) {
++result;
}
return result;
}
#endif // !defined(nsAlgorithm_h___)