Crates.io | aint |
lib.rs | aint |
version | 0.1.0 |
source | src |
created_at | 2023-12-25 22:44:55.176006 |
updated_at | 2023-12-25 22:44:55.176006 |
description | Arbitrary width integers between 1 and 128 |
homepage | https://github.com/Vociferix/aint |
repository | https://github.com/Vociferix/aint |
max_upload_size | |
id | 1080524 |
size | 821,096 |
Aint is a crate implementing integers of non-standard bit widths between
1 and 127. These integer types are represented by the next largest built-in
Rust integer, but are bounded to the range and behaviors of the advertised
bit width. That is, T::MIN
and T::MAX
, are what would be expected for
the integer T
with N
bits, and similarly, wrapping, saturating, and
overflow behaviors match what would be expected for a hypothetical built-in
integer T
with N
bits.
fn add(a: i13, b: i13) -> i13 {
a + b
}
let x = i13!(100);
let y = add(x, i13!(-42));
assert_eq!(y, i13!(58));
See the documentation for details.