aboutsummaryrefslogtreecommitdiff
path: root/src/utility.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/utility.js')
-rw-r--r--src/utility.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/utility.js b/src/utility.js
index 4ffe46a0..5ddccfd4 100644
--- a/src/utility.js
+++ b/src/utility.js
@@ -297,6 +297,10 @@ function log2(x) {
return Math.log(x)/Math.LN2;
}
+function isPowerOfTwo(x) {
+ return x > 0 && ((x & (x-1)) == 0);
+}
+
function Benchmarker() {
var starts = {}, times = {}, counts = {};
this.start = function(id) {