Git Product home page Git Product logo

bitwise_packable's Introduction

Bitwise Packable Workspace

This workspace contains two crates: rbitpack and bitval. Together, they provide efficient bit manipulation and packing functionalities for Rust projects.

Crates

The rbitpack crate provides macros and utilities for packing and unpacking boolean fields into various bit sizes. It is designed to work with structs, allowing for efficient bitwise operations.

The bitval crate provides the Bitfield struct, which allows for efficient storage and manipulation of individual bits. It is used as the underlying data structure for the rbitpack crate.

Getting Started

Cloning the Repository

To get started, clone the repository:

git clone https://github.com/teckmk/bitwise_packable.git
cd bitwise_packable

Building the Workspace

To build the entire workspace, run:

cargo build

Running Tests

Each crate contains its own set of tests. To run all tests in the workspace, use:

cargo test

rbitpack Crate

Overview

The rbitpack crate provides macros for packing and unpacking boolean fields into various bit sizes. It supports custom attributes to handle overflow values and dynamic bit sizes.

Usage

Add rbitpack to your Cargo.toml:

[dependencies]
rbitpack = "0.1.0" // Replace with the current version

Example

use rbitpack::BitwisePackable;

#[derive(BitwisePackable)]
struct Example {
    field1: bool,
    field2: bool,
    field3: bool,
    // ...
}

Running Tests

To run tests for rbitpack:

cd rbitpack
cargo test

For more details, see the rbitpack README.

bitval Crate

Overview

The bitval crate provides the Bitfield struct for efficient bit storage and manipulation. It supports setting and getting individual bits and is used by the rbitpack crate.

Usage

Add bitval to your Cargo.toml:

[dependencies]
bitval = "0.1.0" // Replace with the current version

Example

use bitval::Bitfield;

fn main() {
    let size = 128;
    let mut bitfield = Bitfield::new(size);

    bitfield.set(5, true);
    bitfield.set(10, false);

    let value = bitfield.get(5);
    println!("Value of 5th bit: {}", value); // Output: Value of 5th bit: true
}

Running Tests

To run tests for bitval:

cd bitval
cargo test

For more details, see the bitval README.

Development

Adding New Features

  1. Create a new branch for your feature:

    git checkout -b feature-name
  2. Make your changes and commit them:

    git commit -am "Add new feature"
  3. Push your branch to the remote repository:

    git push origin feature-name
  4. Create a pull request on GitHub.

Contributing

Contributions are welcome! Please open an issue or submit a pull request with your changes. Make sure to include tests for any new features or bug fixes.

License

This project is licensed under the MIT License.

Contact

For questions or feedback, please contact me here.

bitwise_packable's People

Contributors

teckmk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.