aboutsummaryrefslogtreecommitdiff
path: root/src/utility.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-02-06 15:49:21 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-02-06 15:49:21 -0800
commitc34404474ee6aa9d1c3f368792057729837812f3 (patch)
treed7752ad459e70370b356ca229a361348a058a229 /src/utility.js
parent749ca8a878fa3abe95d021b0a2028b23a40245ce (diff)
optimize memory alignment calculations
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) {