UNPKG

cione-comp-lib

Version:

`$ yarn add cione-comp-lib` 或者 `$ npm i cione-comp-lib -S`

20 lines (19 loc) 474 B
var mathUtil = {}; mathUtil.isPowerOfTwo = function(value) { return (value & value - 1) === 0; }; mathUtil.nextPowerOfTwo = function(value) { value--; value |= value >> 1; value |= value >> 2; value |= value >> 4; value |= value >> 8; value |= value >> 16; value++; return value; }; mathUtil.nearestPowerOfTwo = function(value) { return Math.pow(2, Math.round(Math.log(value) / Math.LN2)); }; var mathUtil$1 = mathUtil; export { mathUtil$1 as default };