Export U256 and U512

This commit is contained in:
David Palm 2018-08-13 13:56:23 +02:00
parent 85ba498a4b
commit 97ecf175c8
5 changed files with 11 additions and 7 deletions

View File

@ -12,9 +12,9 @@ byteorder = { version = "1", default-features = false }
heapsize = { version = "0.4.2", optional = true } heapsize = { version = "0.4.2", optional = true }
rustc-hex = { version = "2.0", default-features = false } rustc-hex = { version = "2.0", default-features = false }
quickcheck = { version = "0.6", optional = true } quickcheck = { version = "0.6", optional = true }
crunchy = "0.1"
[dev-dependencies] [dev-dependencies]
crunchy = "0.1.5"
quickcheck = "0.6" quickcheck = "0.6"
rustc-hex = "2.0" rustc-hex = "2.0"

View File

@ -1,8 +1,8 @@
# Big unsigned integer types # Big unsigned integer types
Implementation of a various large-but-fixed sized unsigned integer types. Implementation of a various large-but-fixed sized unsigned integer types.
The functions here are designed to be fast. There are optional `x86_64` The functions here are designed to be fast.
implementations for even more speed, hidden behind the `x64_arithmetic`
feature flag. The crate exports two commonly used types: `U256` and `U512`. Other sizes can be constructed with `construct_uint!(NAME, SIZE_IN_WORDS)`, e.g. `construct_uint!(U128, 2);`.
Run tests with `cargo test --features=std,impl_quickcheck_arbitrary`. Run tests with `cargo test --features=std,impl_quickcheck_arbitrary`.

View File

@ -32,5 +32,8 @@ pub extern crate quickcheck;
#[cfg(all(not(feature = "std"), test))] #[cfg(all(not(feature = "std"), test))]
extern crate alloc; extern crate alloc;
#[macro_use]
extern crate crunchy;
mod uint; mod uint;
pub use uint::*; pub use uint::*;

View File

@ -1367,3 +1367,6 @@ macro_rules! impl_quickcheck_arbitrary_for_uint {
macro_rules! impl_quickcheck_arbitrary_for_uint { macro_rules! impl_quickcheck_arbitrary_for_uint {
($uint: ty, $n_bytes: tt) => {} ($uint: ty, $n_bytes: tt) => {}
} }
construct_uint!(U256, 4);
construct_uint!(U512, 8);

View File

@ -10,11 +10,9 @@ extern crate quickcheck;
use core::u64::MAX; use core::u64::MAX;
use core::str::FromStr; use core::str::FromStr;
use uint::FromDecStrErr; use uint::{U256, U512, FromDecStrErr};
construct_uint!(U128, 2); construct_uint!(U128, 2);
construct_uint!(U256, 4);
construct_uint!(U512, 8);
#[test] #[test]
fn uint256_checked_ops() { fn uint256_checked_ops() {