Skip to content
Snippets Groups Projects
Commit 56935597 authored by Alexander Rose's avatar Alexander Rose
Browse files

added isPowerOfTwo

parent c2cbc9f9
No related branches found
No related tags found
No related merge requests found
/**
* 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment