Crates.io | bitmap4rust |
lib.rs | bitmap4rust |
version | 1.0.1 |
source | src |
created_at | 2018-02-25 08:06:50.35562 |
updated_at | 2018-04-30 09:41:44.220669 |
description | A Rust library for creating and manipulating bitmaps |
homepage | |
repository | https://www.github.com/aditisrinivas97/bitmap4rust |
max_upload_size | |
id | 52767 |
size | 8,511 |
A Rust library for creating and manipulating Bitmaps.
The bitmap is maintained in a byte vector of appropriate size. Hence, it's type should be Vec<u8>
.
pub fn bitmap_create(bitmap_size: &mut u64) -> Vec<u8>
Used to create the bitmap. Since the bitmap is maintained as a byte vector, it must be of type Vec<u8>
.
pub fn clear_bit(bitmap: &mut Vec<u8>, bitno: u64) -> i32
Used to clear the bit at bitno
, i.e, set it to 0. If bitno
is larger than the bitmap's size, -1 is returned.
pub fn set_bit(bitmap: &mut Vec<u8>, bitno: u64) -> i32
Used to set the bit at bitno
, i.e, set it to 1. If bitno
is larger than the bitmap's size, -1 is returned.
pub fn get_first_set_bit(bitmap: &mut Vec<u8>) -> i64
Used to get the first bit of bitmap
that is set to 1. Returns -1 if none are set.
pub fn get_first_unset_bit(bitmap: &mut Vec<u8>) -> i64
Used to get the first bit of bitmap
that is set to 0. Returns -1 if all bits are set.
pub fn check_bit(bitmap: &mut Vec<u8>, bitno: u64) -> i32
Used to check the value of the bit corresponding to bitno
.
bitmap4rust
in Cargo.toml
[dependencies]
bitmap4rust = "1.0.1"
bitmap4rust
extern crate bitmap4rust;