setbits

Crates.iosetbits
lib.rssetbits
version0.1.0
created_at2025-08-07 14:28:41.402065+00
updated_at2025-08-07 14:28:41.402065+00
descriptionCreate an unsigned integer with the high/low `n` bits set to `1`
homepage
repositoryhttps://github.com/Oakchris1955/setbits-rs
max_upload_size
id1785377
size7,191
Oakchris1955 (Oakchris1955)

documentation

README

setbits: Easily and efficiently create bitmasks

CI Status MIT licensed crates.io Documentation Minimum rustc version

Create an unsigned integer with the high/low n bits set to 1

All functions are const

This crate can be particularly useful for creating bit masks

Features

The inline feature is enabled by default and inlines all the functions with a suggestion that they should be inline (#[inline])

Attribution

Original code for setbits_u32_lo taken from: https://users.rust-lang.org/t/how-to-make-an-integer-with-n-bits-set-without-overflow/63078/3

LICENSE

MIT

Commit count: 0

cargo fmt