21 releases

0.9.1 Jun 30, 2021
0.9.0 Jan 5, 2021
0.8.5 Aug 12, 2020
0.8.3 Apr 27, 2020
0.1.0 Dec 29, 2017
Download history 29812/week @ 2021-08-13 34164/week @ 2021-08-20 36284/week @ 2021-08-27 34525/week @ 2021-09-03 40768/week @ 2021-09-10 37793/week @ 2021-09-17 40297/week @ 2021-09-24 38765/week @ 2021-10-01 44863/week @ 2021-10-08 43578/week @ 2021-10-15 36877/week @ 2021-10-22 40969/week @ 2021-10-29 44717/week @ 2021-11-05 47636/week @ 2021-11-12 46699/week @ 2021-11-19 49295/week @ 2021-11-26

196,705 downloads per month
Used in 643 crates (55 directly)

MIT/Apache

52KB
1.5K SLoC

Uint

Description

Provides facilities to construct big unsigned integer types which use no allocations (stack-based, fixed bit length). If you want to use a predefined U128, U256 or U512 type, take a look at the primitive-types or ethereum-types crate.

The focus on the provided big unsigned integer types is performance and cross-platform availability. Support a very similar API as the built-in primitive integer types.

Usage

In your Cargo.toml paste

uint = "0.8"

Import the macro

use uint::construct_uint;

If you're using pre-edition Rust in your main file

#[macro_use]
extern crate uint;

Construct your own big unsigned integer type as follows.

// U1024 with 1024 bits consisting of 16 x 64-bit words
construct_uint! {
	pub struct U1024(16);
}

Tests

Basic tests

cargo test --release

Basic tests + property tests

cargo test --release --features=quickcheck

Benchmark tests

cargo bench

Fuzz tests

see fuzz README.md

Crate Features

  • std: Use Rust's standard library.
    • Enables byteorder/std, rustc-hex/std
    • Enabled by default.
  • quickcheck: Enable quickcheck-style property testing
    • Use with cargo test --release --features=quickcheck.
  • arbitrary: Allow for creation of an uint object from random unstructured input for use with fuzzers that use the arbitrary crate.
    • Disabled by default.

Dependencies

~210KB