mirror of
https://github.com/photonstorm/phaser
synced 2024-12-26 21:13:41 +00:00
6585297fbf
Restructured Phaser export file, finally removing it out of the Boot folder. Fixed several broken math functions.
11 lines
238 B
JavaScript
11 lines
238 B
JavaScript
// Takes value and returns the nearest power of 2
|
|
|
|
var GetPowerOfTwo = function (value)
|
|
{
|
|
// Math.log(2)
|
|
var index = Math.log(value) / 0.6931471805599453;
|
|
|
|
return (1 << Math.ceil(index));
|
|
};
|
|
|
|
module.exports = GetPowerOfTwo;
|