Crate twelve_bit [] [src]

The U12 Library

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.





Creates a 12-bit value via unchecked-into conversion. This is meant to simplify describing U12 literal values, as the $x parameter is first bound to a 16-bit value. This allows the compiler to elide the type of the literal, and does compile-time validation that no literal greater than 0xFFFF is specified; this will panic for values in the range 0x1000...0xFFFF.