twelve_bit 0.1.1

A Rust library for representing 12-bit unsigned values. This is primarily useful for implementing Chip-8 assemblers and interpreters safely. The type implements the bulk of the standard Rust literal semantics and operators, and much of the documentation is adapted from the u16 intrinsic type.
Documentation
  • Coverage
  • 95.56%
    43 out of 45 items documented35 out of 41 items with examples
  • Size
  • Source code size: 63.07 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.07 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Documentation
  • martinmroz/12bit
    8 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • martinmroz

twelve_bit

A Rust library for representing 12-bit unsigned values. This is primarily useful for implementing Chip-8 assemblers and interpreters safely. The type implements bulk of the standard Rust literal semantics and operators, and much of the documentation is adapted from the u16 intrinsic type.

Build Status Coverage Status

Usage

Add the following to your Cargo.toml:

[dependencies]
twelve_bit = "0.1"

In addition, and this to your crate root:

#[macro_use]
extern crate twelve_bit;

Here is an example demonstrating how to interact with the U12 data type.

#[macro_use]
extern crate twelve_bit;

use twelve_bit::u12::*;

fn main() {
  assert_eq!(u12![1] + u12![2], u12![3]);
  assert_eq!(u12![4095], U12::maximum_value());
  assert_eq!(u12![4095].overflowing_add(u12![1]), (u12![0], true));
  assert_eq!(u12![4095].overflowing_add(u12![1]), (u12![0], true));
}

Missing Features

  • Support for ShlAssign and ShrAssign.
  • Support for bitwise assignment traits.
  • Support for U12::from_str_radix().
  • Support for Display, UpperHex, LowerHex, Octal and Binary.
  • Support for Hash.
  • Support for Step.

License

twelve_bit is distributed under the terms of the MIT license.

See LICENSE for details.