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

Unified Diff: third_party/WebKit/Source/platform/audio/HRTFKernel.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/HRTFKernel.cpp
diff --git a/third_party/WebKit/Source/platform/audio/HRTFKernel.cpp b/third_party/WebKit/Source/platform/audio/HRTFKernel.cpp
index 23d1754dac7d7a4a7bdf8fe343d71b92c217df1f..9f8698007162904b68d49be7c6cb285d2baac3ae 100644
--- a/third_party/WebKit/Source/platform/audio/HRTFKernel.cpp
+++ b/third_party/WebKit/Source/platform/audio/HRTFKernel.cpp
@@ -35,6 +35,7 @@
#include "platform/audio/AudioChannel.h"
#include "platform/FloatConversion.h"
#include "wtf/MathExtras.h"
+#include <algorithm>
Raymond Toy 2015/12/17 19:45:55 Why is algorithm needed now?
Daniel Bratell 2015/12/17 22:56:16 The code still uses std::min in the HRTFKernel con
namespace blink {
@@ -114,7 +115,7 @@ PassOwnPtr<HRTFKernel> HRTFKernel::createInterpolatedKernel(HRTFKernel* kernel1,
return nullptr;
ASSERT(x >= 0.0 && x < 1.0);
- x = std::min(1.0f, std::max(0.0f, x));
+ x = clampTo(x, 0.0f, 1.0f);
float sampleRate1 = kernel1->sampleRate();
float sampleRate2 = kernel2->sampleRate();

Powered by Google App Engine
This is Rietveld 408576698