Skip to content

KBE3D / KBCore / Cesium / Math / nextPowerOfTwo

函数: nextPowerOfTwo()

nextPowerOfTwo(n: number): number

Computes the next power-of-two integer greater than or equal to the provided non-negative integer. The maximum allowed input is 2^31 due to 32-bit bitwise operator limitation in Javascript.

参数

n

number

The integer to test in the range [0, 2^31].

返回

number

The next power-of-two integer.

示例

ts
const n = Cesium.Math.nextPowerOfTwo(29); // 32
const m = Cesium.Math.nextPowerOfTwo(32); // 32

KBE3D @3.0.0 Copyright © 2024-present KBE3D