From 5693559746e8be1cf2e9de9ec586c58145b1ad26 Mon Sep 17 00:00:00 2001
From: Alexander Rose <alexander.rose@weirdbyte.de>
Date: Mon, 15 Apr 2019 22:57:09 -0700
Subject: [PATCH] added isPowerOfTwo

---
 src/mol-math/misc.ts | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/mol-math/misc.ts b/src/mol-math/misc.ts
index 98dd209ea..cfcb0d235 100644
--- a/src/mol-math/misc.ts
+++ b/src/mol-math/misc.ts
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ * Copyright (c) 2018-2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
  *
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
@@ -10,4 +10,8 @@ export function degToRad (deg: number) {
 
 export function radToDeg (rad: number) {
     return rad * 57.29578  // rad * 180 / Math.PI
+}
+
+export function isPowerOfTwo (x: number) {
+    return (x !== 0) && (x & (x - 1)) === 0
 }
\ No newline at end of file
-- 
GitLab