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

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: Handling that minimumThumbLength > trackLen. 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 1815742f45ba3e9944be5c618f51e12a192e0469..3d96ca464ba143d2775233d5a62e715fee988036 100644
--- a/third_party/WebKit/Source/platform/audio/HRTFDatabase.cpp
+++ b/third_party/WebKit/Source/platform/audio/HRTFDatabase.cpp
@@ -32,6 +32,8 @@
#include "platform/audio/HRTFDatabase.h"
+#include "wtf/MathExtras.h"
+
namespace blink {
const int HRTFDatabase::MinElevation = -45;
@@ -108,8 +110,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;

Powered by Google App Engine
This is Rietveld 408576698