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

Unified Diff: third_party/WebKit/Source/platform/audio/AudioUtilities.h

Issue 2582323003: Test for power of two safely (Closed)
Patch Set: Created 4 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/AudioUtilities.h
diff --git a/third_party/WebKit/Source/platform/audio/AudioUtilities.h b/third_party/WebKit/Source/platform/audio/AudioUtilities.h
index ccb70083ff9cf98940639fcf5c9a368416e20fa3..8844ff84853bacd1809453c8dcda8181bdca73b7 100644
--- a/third_party/WebKit/Source/platform/audio/AudioUtilities.h
+++ b/third_party/WebKit/Source/platform/audio/AudioUtilities.h
@@ -57,6 +57,10 @@ PLATFORM_EXPORT bool isValidAudioBufferSampleRate(float sampleRate);
// Return max/min sample rate supported by AudioBuffers.
PLATFORM_EXPORT float minAudioBufferSampleRate();
PLATFORM_EXPORT float maxAudioBufferSampleRate();
+
+// Check to see if x is a power of two. If x == 0, returns false.
+PLATFORM_EXPORT bool isPowerOfTwo(size_t x);
+
} // namespace AudioUtilities
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698