
Security News
US Government Forces Anthropic to Pull Claude Fable Days After Launch
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.
extra-bit
Advanced tools
The bit is a basic unit of information in information theory, computing.
📦 Node.js,
🌐 Web,
📜 Files,
📰 Docs,
📘 Wiki.
The concept of a bit, which stands for binary digit, has been a
fundamental unit of information in the fields of information theory and
computing. Bitwise operations are used to manipulate and process data at the bit
level, and these operations are crucial for efficient programming in a variety
of domains, such as computer graphics and cryptography. JavaScript converts a
Number (a 64-bit floating point number) to a 32-bit integer when bitwise
operators (such as |) are applied. All bitwise operations are performed on
32-bit integers. This package includes bit twiddling hacks by Sean Eron
Anderson and many others.
This package is available in Node.js and Web formats. To use it on the web,
simply use the extra_bit global variable after loading with a <script>
tag from the jsDelivr CDN.
Stability: Experimental.
const xbit = require('extra-bit');
// import * as xbit from "extra-bit";
// import * as xbit from "https://unpkg.com/extra-bit/index.mjs"; (deno)
xbit.count(7);
// → 3 (111 ⇒ 3)
xbit.parity(8, 2);
// → 2 (10,00 ⇒ 10)
xbit.swap(6, 1, 0);
// → 5 (110 ⇒ 101)
xbit.reverse(0xFFFF0000);
// → 65535 (0x0000FFFF)
xbit.signExtend(15, 4);
// → -1
| Property | Description |
|---|---|
| get | Get bits at specified index. |
| getAs | Get bits as per mask. |
| set | Set bits at specified index. |
| setAs | Set bits as per mask. |
| toggle | Toggle bits at specified index. |
| toggleAs | Toggle bits as per mask. |
| swap | Swap bit sequences at specified indices. |
| scan | Find index of first set bit from LSB. |
| scanReverse | Find index of first set bit from MSB. |
| count | Count bits set. |
| parity | Calculate n-bit parity. |
| rotate | Rotate bits by a certain amount. |
| reverse | Reverse all bits. |
| merge | Merge bits as per mask. |
| interleave | Interleave bits of two int16s. |
| signExtend | Sign extend variable bit-width integer. |
FAQs
The bit is a basic unit of information in information theory, computing.
The npm package extra-bit receives a total of 28 weekly downloads. As such, extra-bit popularity was classified as not popular.
We found that extra-bit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.

Security News
A network of 152 Chrome live wallpaper extensions hid ad tracking and made extension-driven traffic look like Google search clicks.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.