amplify_num/
lib.rs

1// Rust language amplification library providing multiple generic trait
2// implementations, type wrappers, derive macros and other language enhancements
3//
4// Written in 2020-2024 by
5//     Dr. Maxim Orlovsky <orlovsky@ubideco.org>
6//
7// To the extent possible under law, the author(s) have dedicated all
8// copyright and related and neighboring rights to this software to
9// the public domain worldwide. This software is distributed without
10// any warranty.
11//
12// You should have received a copy of the MIT License
13// along with this software.
14// If not, see <https://opensource.org/licenses/MIT>.
15
16//! Custom-sized numeric types
17//!
18//! Implementation of a various integer types with custom bit dimension. This
19//! includes:
20//! * large signed and unsigned integers, named *large int types* (256, 512,
21//!   1024-bit)
22//! * custom sub-8 bit unsigned integers, named *small int types* (from 1 to
23//!   7-bit)
24//! * 24-, 40-, 48- and 56-bit unsigned integer.
25//!
26//! The functions here are designed to be fast.
27
28#![cfg_attr(not(feature = "std"), no_std)]
29#[cfg(feature = "alloc")]
30extern crate alloc;
31extern crate core;
32
33#[cfg(feature = "serde")]
34#[macro_use]
35extern crate serde_crate as serde;
36
37mod bigint;
38pub mod error;
39#[cfg(feature = "hex")]
40pub mod hex;
41pub mod posit;
42mod smallint;
43
44pub use bigint::{i1024, i256, i512, u1024, u256, u512};
45pub use smallint::{u1, u2, u24, u3, u4, u40, u48, u5, u56, u6, u7};
46
47// TODO: Create arbitrary precision types
48// TODO: Move from using `u64` to `u128` for big int types