extra-bit

The bit is a basic unit of information in information theory, computing.

https://github.com/nodef/extra-bit

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.6%) to scientific vocabulary

Keywords

bit bitwise count extra get get-as interleave manipulation merge operation parity reverse rotate scan scan-reverse set set-as sign-extend swap toggle
Last synced: 4 months ago · JSON representation ·

Repository

The bit is a basic unit of information in information theory, computing.

Basic Info
Statistics
  • Stars: 3
  • Watchers: 2
  • Forks: 1
  • Open Issues: 1
  • Releases: 1
Topics
bit bitwise count extra get get-as interleave manipulation merge operation parity reverse rotate scan scan-reverse set set-as sign-extend swap toggle
Created almost 6 years ago · Last pushed 9 months ago
Metadata Files
Readme License Citation

README.md

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.


```javascript 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 ```



Index

| 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. |



References




ORG DOI Coverage Status Test Coverage Maintainability

Owner

  • Name: nodef
  • Login: nodef
  • Kind: organization

A summary of programs made with Node.js.

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: Sahu
    given-names: Subhajit
    orcid: https://orcid.org/0000-0001-5140-6578
title: "nodef/extra-bit: A collection of common bitwise operations"
version: 2.1.0
doi: 10.5281/zenodo.6791857
date-released: 2022-07-03

GitHub Events

Total
  • Push event: 2
Last Year
  • Push event: 2

Committers

Last synced: 6 months ago

All Time
  • Total Commits: 101
  • Total Committers: 1
  • Avg Commits per committer: 101.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 2
  • Committers: 1
  • Avg Commits per committer: 2.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Subhajit Sahu w****7@g****m 101

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 3
  • Total pull requests: 46
  • Average time to close issues: N/A
  • Average time to close pull requests: 1 day
  • Total issue authors: 1
  • Total pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.98
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 31
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • wolfram77 (1)
Pull Request Authors
  • dependabot[bot] (6)
  • wolfram77 (4)
Top Labels
Issue Labels
Pull Request Labels
dependencies (6)

Packages

  • Total packages: 35
  • Total downloads:
    • npm 6,400 last-month
  • Total dependent packages: 67
    (may contain duplicates)
  • Total dependent repositories: 0
    (may contain duplicates)
  • Total versions: 2,068
  • Total maintainers: 1
npmjs.org: @extra-bit/scan-reverse.min

Finds index of first set bit from MSB.

  • Versions: 64
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 209 Last month
Rankings
Dependent packages count: 9.5%
Downloads: 13.3%
Stargazers count: 15.5%
Average: 16.2%
Forks count: 17.4%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/sign-extend

Sign extends variable bit-width integer.

  • Versions: 64
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 229 Last month
Rankings
Dependent packages count: 9.5%
Downloads: 14.1%
Stargazers count: 15.5%
Average: 16.4%
Forks count: 17.4%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/get

Gets a bit.

  • Versions: 65
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 211 Last month
Rankings
Dependent packages count: 9.5%
Downloads: 14.5%
Stargazers count: 15.5%
Average: 16.5%
Forks count: 17.4%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/sign-extend.min

Sign extends variable bit-width integer.

  • Versions: 64
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 210 Last month
Rankings
Dependent packages count: 9.5%
Downloads: 14.7%
Stargazers count: 15.5%
Average: 16.5%
Forks count: 17.4%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/get.min

Gets a bit.

  • Versions: 65
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 210 Last month
Rankings
Dependent packages count: 9.5%
Downloads: 14.7%
Stargazers count: 15.5%
Average: 16.5%
Forks count: 17.4%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/interleave

Interleaves bits of two int16s.

  • Versions: 65
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 228 Last month
Rankings
Dependent packages count: 9.5%
Downloads: 14.7%
Stargazers count: 15.5%
Average: 16.5%
Forks count: 17.4%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/set.min

Sets a bit.

  • Versions: 64
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 213 Last month
Rankings
Dependent packages count: 9.5%
Downloads: 14.8%
Stargazers count: 15.5%
Average: 16.5%
Forks count: 17.4%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/parity.min

Finds n-bit parity.

  • Versions: 64
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 207 Last month
Rankings
Dependent packages count: 9.5%
Downloads: 15.0%
Stargazers count: 15.5%
Average: 16.5%
Forks count: 17.4%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/scan-reverse

Finds index of first set bit from MSB.

  • Versions: 64
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 226 Last month
Rankings
Dependent packages count: 9.5%
Downloads: 15.0%
Stargazers count: 15.5%
Average: 16.5%
Forks count: 17.4%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/count.min

Counts bits set.

  • Versions: 65
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 209 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Downloads: 15.8%
Average: 16.7%
Forks count: 17.4%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: extra-bit

The bit is a basic unit of information in information theory, computing.

  • Versions: 147
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 67 Last month
Rankings
Downloads: 9.1%
Stargazers count: 15.5%
Dependent packages count: 16.2%
Average: 16.7%
Forks count: 17.4%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 5 months ago
npmjs.org: @extra-bit/set-as

Sets bits as per mask.

  • Versions: 64
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 233 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Downloads: 16.3%
Average: 16.8%
Forks count: 17.4%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/get-as

Gets bits as per mask.

  • Versions: 28
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 110 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Downloads: 16.7%
Average: 16.9%
Forks count: 17.4%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/scan.min

Finds index of first set bit from LSB.

  • Versions: 64
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 213 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Average: 17.0%
Downloads: 17.0%
Forks count: 17.4%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/scan

Finds index of first set bit from LSB.

  • Versions: 64
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 212 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Average: 17.2%
Forks count: 17.4%
Downloads: 18.0%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/set-as.min

Sets bits as per mask.

  • Versions: 64
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 281 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Average: 17.2%
Forks count: 17.4%
Downloads: 18.3%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/set

Sets a bit.

  • Versions: 64
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 225 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Forks count: 17.4%
Average: 17.4%
Downloads: 19.4%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/toggle-as

Toggles bits as per mask.

  • Versions: 32
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 163 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Forks count: 17.4%
Average: 17.5%
Downloads: 19.8%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/merge

Merges bits as per mask.

  • Versions: 65
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 227 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Forks count: 17.4%
Average: 17.7%
Downloads: 20.6%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/parity

Finds n-bit parity.

  • Versions: 64
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 229 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Forks count: 17.4%
Average: 17.7%
Downloads: 20.8%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/toggle

Toggles a bit.

  • Versions: 32
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 116 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Forks count: 17.4%
Average: 17.8%
Downloads: 21.3%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/count

Counts bits set.

  • Versions: 65
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 226 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Forks count: 17.4%
Average: 17.9%
Downloads: 21.5%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/reverse

Reverses all bits.

  • Versions: 64
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 223 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Forks count: 17.4%
Average: 17.9%
Downloads: 21.5%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/toggle-as.min

Toggles bits as per mask.

  • Versions: 32
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 107 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Forks count: 17.4%
Average: 17.9%
Downloads: 21.7%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/toggle.min

Toggles a bit.

  • Versions: 32
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 141 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Forks count: 17.4%
Average: 18.1%
Downloads: 22.5%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: extra-bit.min

The bit is a basic unit of information in information theory, computing.

  • Versions: 47
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 28 Last month
Rankings
Stargazers count: 15.5%
Downloads: 16.0%
Dependent packages count: 16.2%
Forks count: 17.4%
Average: 18.1%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 4 months ago
npmjs.org: @extra-bit/swap

Swaps bit sequences.

  • Versions: 64
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 214 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Forks count: 17.4%
Average: 18.1%
Downloads: 22.8%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/interleave.min

Interleaves bits of two int16s.

  • Versions: 65
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 219 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Forks count: 17.4%
Average: 18.2%
Downloads: 23.1%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/merge.min

Merges bits as per mask.

  • Versions: 65
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 213 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Forks count: 17.4%
Average: 18.2%
Downloads: 23.1%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/reverse.min

Reverses all bits.

  • Versions: 64
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 217 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Forks count: 17.4%
Average: 18.2%
Downloads: 23.1%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/get-as.min

Gets bits as per mask.

  • Versions: 28
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 93 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Forks count: 17.4%
Average: 18.4%
Downloads: 24.0%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/swap.min

Swaps bit sequences.

  • Versions: 64
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 216 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Forks count: 17.4%
Average: 18.6%
Downloads: 25.0%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: extra-bit.web

The bit is a basic unit of information in information theory, computing {web}.

  • Versions: 74
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 30 Last month
Rankings
Downloads: 14.0%
Dependent packages count: 16.2%
Stargazers count: 17.7%
Average: 18.8%
Forks count: 20.5%
Dependent repos count: 25.3%
Maintainers (1)
Last synced: 5 months ago
npmjs.org: @extra-bit/rotate

Rotates bits.

  • Versions: 36
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 123 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Forks count: 17.4%
Average: 19.5%
Dependent repos count: 25.3%
Downloads: 29.7%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: @extra-bit/rotate.min

Rotates bits.

  • Versions: 36
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 122 Last month
Rankings
Dependent packages count: 9.5%
Stargazers count: 15.5%
Forks count: 17.4%
Average: 19.7%
Dependent repos count: 25.3%
Downloads: 30.9%
Maintainers (1)
Last synced: 6 months ago

Dependencies

package-lock.json npm
  • 339 dependencies
package.json npm
  • @rollup/plugin-commonjs ^22.0.2 development
  • @rollup/plugin-node-resolve ^13.3.0 development
  • @types/jest ^28.1.6 development
  • extra-build ^2.2.26 development
  • jest ^28.1.3 development
  • rollup-plugin-cleanup ^3.2.1 development
  • rollup-plugin-dts ^4.2.2 development
  • ts-jest ^28.0.7 development
.github/workflows/ci.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v2 composite
  • coverallsapp/github-action master composite
  • paambaati/codeclimate-action v3.0.0 composite
.github/workflows/pr.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v2 composite