Chubercik / i48

`i48` provides a 48-bit signed integer type for Rust, filling the gap between `i32` and `i64`. This type may be useful in certain scenarios where 48-bit precision is required but 64 bits would be excessive.
https://crates.io/crates/i48
MIT License
0 stars 0 forks source link

i48: A 48-bit Signed Integer Type for Rust

i48 provides a 48-bit signed integer type for Rust, filling the gap between i32 and i64. This type may be useful in certain scenarios where 48-bit precision is required but 64 bits would be excessive.

Features

Installation

Add this to your Cargo.toml:

[dependencies]
i48 = "1.2.0"

Usage

use i48::i48;

let a: i48 = 1000.into();
let b: i48 = 2000.into();
let c = a + b;

assert_eq!(c.to_i64(), 3000);

Safety and Limitations

Always use checked arithmetic operations when dealing with untrusted input or when overflow/underflow is a concern.

Optional Features

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. This project needs more testing and verification.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Related Projects

This crate came about as a twin project to the i24 crate, one that supports 48-bit signed integers.

Also, check out: