17 releases

✓ Uses Rust 2018 edition

0.8.3 Apr 27, 2020
0.8.2 Oct 24, 2019
0.8.1 Aug 8, 2019
0.8.0 Jun 13, 2019
0.1.0 Dec 29, 2017
Download history 8851/week @ 2020-02-06 9080/week @ 2020-02-13 9071/week @ 2020-02-20 11365/week @ 2020-02-27 10463/week @ 2020-03-05 13313/week @ 2020-03-12 11759/week @ 2020-03-19 12480/week @ 2020-03-26 12801/week @ 2020-04-02 11146/week @ 2020-04-09 15732/week @ 2020-04-16 15864/week @ 2020-04-23 13660/week @ 2020-04-30 15762/week @ 2020-05-07 16450/week @ 2020-05-14 11651/week @ 2020-05-21

48,459 downloads per month
Used in 277 crates (21 directly)

MIT/Apache

48KB
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

~130–290KB