Files
TheGame/packages/web/utils/mathHelper.ts
2021-03-28 22:08:25 -06:00

4 lines
127 B
TypeScript

// true if the number is a power of 2
export const isPow2 = (int: number): boolean => (
int > 0 && (int & (int - 1)) === 0
);