# next-pow-2 **Repository Path**: ArkTSCentralRepository/next-pow-2 ## Basic Information - **Project Name**: next-pow-2 - **Description**: Rounds an integer up to a power of 2 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-01 - **Last Updated**: 2026-04-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # next-pow-2 基于[next-pow-2](https://www.npmjs.com/package/next-pow-2)原库1.0.0版本进行适配 > Round a nonnegative integer up to the next power of 2. ## Install ```sh ohpm install next-pow-2 ``` ## Usage ```typescript import np2 from 'next-pow-2'; for(let i = 0; i <= 10; ++i) { console.log(i + ' rounds to ' + np2(i)) } ``` #### Output ``` 0 rounds to 1 1 rounds to 1 2 rounds to 2 3 rounds to 4 4 rounds to 4 5 rounds to 8 6 rounds to 8 7 rounds to 8 8 rounds to 8 9 rounds to 16 10 rounds to 16 ``` ## API #### `np2(x)` Rounds `x` to the next power of 2 * `x` is a nonnegative integer less than 2^32 **Returns** the next power of 2 after `x` ## License (c) 2015 Mikola Lysenko. MIT License