Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Unified Diff: third_party/WebKit/Source/platform/audio/HRTFDatabase.cpp

Issue 1530723004: Use clampTo instead of chaining std::max(std::min(...)) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/audio/HRTFDatabase.cpp
diff --git a/third_party/WebKit/Source/platform/audio/HRTFDatabase.cpp b/third_party/WebKit/Source/platform/audio/HRTFDatabase.cpp
index 3231aa892a02b60ef29db46a48c46d58a084ed86..1615f3343799f6c862f17fe0324c3e69fcd1aeb4 100644
--- a/third_party/WebKit/Source/platform/audio/HRTFDatabase.cpp
+++ b/third_party/WebKit/Source/platform/audio/HRTFDatabase.cpp
@@ -30,6 +30,8 @@
#if ENABLE(WEB_AUDIO)
+#include "wtf/MathExtras.h"
+
namespace blink {
const int HRTFDatabase::MinElevation = -45;
@@ -106,8 +108,7 @@ void HRTFDatabase::getKernelsFromAzimuthElevation(double azimuthBlend, unsigned
unsigned HRTFDatabase::indexFromElevationAngle(double elevationAngle)
{
// Clamp to allowed range.
- elevationAngle = std::max(static_cast<double>(MinElevation), elevationAngle);
- elevationAngle = std::min(static_cast<double>(MaxElevation), elevationAngle);
+ elevationAngle = clampTo<double, double>(elevationAngle, MinElevation, MaxElevation);
unsigned elevationIndex = static_cast<int>(InterpolationFactor * (elevationAngle - MinElevation) / RawElevationAngleSpacing);
return elevationIndex;
« no previous file with comments | « third_party/WebKit/Source/platform/audio/EqualPowerPanner.cpp ('k') | third_party/WebKit/Source/platform/audio/HRTFKernel.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698