|0.1.9||May 19, 2022|
|0.1.8||Dec 7, 2021|
|0.1.7||Oct 12, 2021|
|0.1.5||Apr 17, 2021|
#161 in Math
148 downloads per month
Unsigned BigInt implementation, backed by a fixed-size array.
Important: Requires at least Rust 1.51 stable, as it uses
FixedUInt<u32,1> all create a 32-bit unsigned integer, that behaves mostly the same as builtin
FixedUInt<u32, 64> creates a 2048-bit value, that uses native 32-bit math. If running on 8-bit CPU,
FixedUInt<u8, 2048> would work the same, just very much slower.
The crate is written for
no_alloc environments with option for panic-free operation, i.e. embedded MCUs. At least for now, focus is on correctness first and then generated code size, performance comes last. The aim is not to bring in 64-bit math dependencies on 32-bit CPU, to save code space.
The arithmetic operands ( +, -, .add() ) panic on overflow, just like native integer types. Panic-free alternatives like
wrapping_add are supported.
- Implement experimental
unchecked_mathoperands, unchecked_mul, unchecked_div etc.
- Probably needs its own error structs instead of reusing core::fmt::Error and core::num::ParseIntError
- Decimal string to/from conversion, currently only binary and hex strings are supported.
- Comprehensive testing fixture, fully validate all ops up to 32-bit against native types
- Some test code relies on 64-bit ToPrimitive/FromPrimitive conversions, clean this up
- Lots of test code can be written cleaner
- Maybe implement signed version as well.
Note: This crate is mostly written as an exercise for learning the Rust type system and understanding how well it works on microcontrollers, its fitness for any particular purpose or quality has precisely zero guarantees.
CONTRIBUTING.md for details.
Apache 2.0; see
LICENSE for details.
This project is not an official Google project. It is not supported by Google and Google specifically disclaims all warranties as to its quality, merchantability, or fitness for a particular purpose.