UNPKG

arcade-physics

Version:
24 lines 827 B
"use strict"; /** * @author Richard Davey <rich@photonstorm.com> * @copyright 2020 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ Object.defineProperty(exports, "__esModule", { value: true }); /** * Checks if the given `width` and `height` are a power of two. * Useful for checking texture dimensions. * * @function Phaser.Math.Pow2.IsSize * @since 3.0.0 * * @param {number} width - The width. * @param {number} height - The height. * * @return {boolean} `true` if `width` and `height` are a power of two, otherwise `false`. */ const IsSizePowerOfTwo = (width, height) => { return width > 0 && (width & (width - 1)) === 0 && height > 0 && (height & (height - 1)) === 0; }; exports.default = IsSizePowerOfTwo; //# sourceMappingURL=IsSizePowerOfTwo.js.map