|0.12.0||Aug 29, 2023|
|0.11.0||Jun 5, 2023|
|0.10.0||Mar 11, 2023|
|0.7.0||Aug 22, 2022|
|0.1.0||Jul 6, 2021|
#1417 in Math
263 downloads per month
Used in 6 crates (2 directly)
Arbitrary Width Integers
This system of crates together forms a kind of big-integer library with separated storage and
functional structs, manually controlled bitwidth, and bitwidth dependent operations. Instead of one
struct that has all of the allocation and functional capabilities, there are two storage types which
ExtAwi, and a common
Bits reference type that manages
arithmetical functionality. Most operations on
Bits are const and have no allocations.
InlAwi can perform big-integer arithmetic both at compile time and in a
without any allocator at all.
Bits backed by
ExtAwi can use dynamic bitwidths at runtime. If a
function is written purely in terms of
Bits, then any mix of
ExtAwis can be used
as arguments to that function.
FP struct for fixed point numbers is also included, adding more functions for it is
currently a WIP.
InlAwi are provided by the
FP is provided by the
awint_ext crate. The reason for this split is to provide
maximum flexibility to
no-alloc use cases.
ExtAwi is not within
a feature flag, because if a no-
alloc project depended on both
ExtAwi), the flag would be activated for the common compilation of
awint_macros crate is a proc-macro crate with several construction utilities.
awint_dag crate supplies a way to use
awint types as a DSL (Domain Specific Language) for
awint crate compiles these interfaces together and enables or disables different parts of the
system depending on these feature flags:
- "const_support" turns on nightly features that are needed for many functions to be
- "alloc" turns on parts that require an allocator
- "std" turns on parts that require std
- "dag" turns on
- "try_support" turns on some features required for
dag::Optionto fully work
- "debug" turns on some developer functions
- "rand_support" turns on a dependency to
rand_corewithout its default features
- "serde_support" turns on a dependency to
serdewithout its default features
- "zeroize_support" turns on a dependency to
zeroizewithout its default features
Note: By default, "const_support" and "std" are turned on, use
default-features = false and
select specific features to avoid requiring nightly.
NOTE: As of Rust 1.70, if you try to use "const_support" with the macros you may get strange "erroneous constant used" and "deref_mut" errors unless you add all of
#![feature(const_trait_impl)] #![feature(const_mut_refs)] #![feature(const_option)]
to all of the crate roots where you use the macros in
NOTE: As of some versions of Rust starting around 1.70, "const_support" is unfortunately broken on nightly (see https://github.com/AaronKutch/awint/issues/19).
These are currently unimplemented because of other developments and improvements that are being prioritized. Please open an issue or PR if you would like these implemented faster.
- We need a macro for optimizing 2 input, 1 output functions to our inplace style functions. The
base inplace assignment functions can have virtual counterparts (e.g.
x.add_(y)would have the alternative
z = x.add(y)or
z = x + y) and the macro optimizes storage creation and routing.
- Add some missing functions to the mimicking primitives in
- There are many things more to be done with
- Add more functions to
- Some kind of matching macro
- A hybrid stack/heap allocated type like what
- A higher level
ExtAwiwith more traditional big-integer library functions such as a dynamic sign and automatically resizing bitwidth. This higher level wrapper keeps track of leading zeros and ones to speed up operations on very large bitwidth integers with small numerical value.
- Add a
constKaratsuba algorithm to multiplication if possible, or add a
- Better string serialization and deserialization performance. Most basic numerical functions are well optimized, but the serialization performance is currently very bad compared to what is possible.
- Add custom allocator parameter to
- Certain formatting and serialization trait impls need more work.
- Make "const_support" compile on stable. Almost every unstable feature used by these crates is some
constfeature, and will hopefully be stabilized soon.