-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from rust-amplify/develop
Update dependencies, fix u1::to_u8, version bump
- Loading branch information
Showing
9 changed files
with
414 additions
and
128 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ authors = [ | |
"Yudai Kiyofuji <[email protected]>" | ||
] | ||
name = "amplify_apfloat" | ||
version = "0.2.0" | ||
version = "0.3.0" | ||
description = "rustc_apfloat with u256 backend to utilize Octuple precision floating-point format" | ||
license = "MIT OR Apache-2.0" | ||
repository = "https://github.com/rust-amplify/rust-amplify" | ||
|
@@ -21,8 +21,8 @@ alloc = ["amplify_num/alloc"] | |
std = ["amplify_num/std"] | ||
|
||
[dependencies] | ||
amplify_num = { version = "0.5.0", path = "../num", default-features = false } | ||
bitflags = "1.0" | ||
amplify_num = { version = "0.6.0", path = "../num", default-features = false } | ||
bitflags = "2.4.1" | ||
|
||
[target.'cfg(target_arch = "wasm32")'.dependencies] | ||
wasm-bindgen = "0.2" | ||
|
@@ -31,8 +31,3 @@ getrandom = { version = "0.2", features = ["js"], optional = true } | |
|
||
[target.'cfg(target_arch = "wasm32")'.dev-dependencies] | ||
wasm-bindgen-test = "0.3" | ||
|
||
[target.'cfg(target_arch = "wasm32")'.features] | ||
default = ["std"] | ||
alloc = ["amplify_num/alloc"] | ||
std = ["amplify_num/std"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "amplify_num" | ||
version = "0.5.1" | ||
version = "0.6.0" | ||
description = "Amplifying numeric types: big-sized and bit-sized integers" | ||
authors = [ | ||
"Dr. Maxim Orlovsky <[email protected]>", | ||
|
@@ -21,8 +21,7 @@ rust-version = "1.60.0" | |
serde_crate = { package = "serde", version = "1.0", features = ["derive"], optional = true } | ||
|
||
[dev-dependencies] | ||
bincode = "1.3.3" | ||
rand = "0.8.4" | ||
rand = "0.8.5" | ||
serde_crate = { package = "serde", version = "1.0", features = ["derive"] } | ||
serde_json = "1" | ||
|
||
|
@@ -41,11 +40,3 @@ getrandom = { version = "0.2", features = ["js"], optional = true } | |
|
||
[target.'cfg(target_arch = "wasm32")'.dev-dependencies] | ||
wasm-bindgen-test = "0.3" | ||
|
||
[target.'cfg(target_arch = "wasm32")'.features] | ||
default = ["hex"] | ||
all = ["std", "hex", "serde"] | ||
std = [] | ||
serde = ["std", "serde_crate", "hex"] | ||
hex = [] | ||
alloc = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,8 @@ | |
// | ||
// Written in 2014 by | ||
// Andrew Poelstra <[email protected]> | ||
// Refactored & fixed in 2021 by | ||
// Dr. Maxim Orlovsky <orlovsky@pandoracore.com> | ||
// Refactored & fixed in 2021-2024 by | ||
// Dr. Maxim Orlovsky <orlovsky@ubideco.org> | ||
// | ||
// To the extent possible under law, the author(s) have dedicated all | ||
// copyright and related and neighboring rights to this software to | ||
|
@@ -1526,7 +1526,7 @@ mod tests { | |
#[test] | ||
fn fmt_hex() { | ||
let one = u256::ONE; | ||
let mut u_256 = | ||
let u_256 = | ||
u256([0x0000000000000000, 0xAAAAAAAABBBBBBBB, 0x0000000111122222, 0x0000000000000000]); | ||
|
||
// UpperHex | ||
|
@@ -1554,7 +1554,7 @@ mod tests { | |
#[test] | ||
fn fmt_octal() { | ||
let one = u256::ONE; | ||
let mut u_256 = u256([ | ||
let u_256 = u256([ | ||
0o0000000000000000000000, | ||
0o0011222222222222222222, | ||
0o0000000001111111111111, | ||
|
@@ -1581,7 +1581,7 @@ mod tests { | |
#[test] | ||
fn fmt_binary() { | ||
let one = u256::ONE; | ||
let mut u_256 = u256([ | ||
let u_256 = u256([ | ||
0b0000000000000000000000000000000000000000000000000000000000000000, | ||
0b0001111000011110001111000011110001111000011110001111000011110000, | ||
0b0000000000000000000000000000001111111111111111111111111111111111, | ||
|
@@ -1867,10 +1867,6 @@ mod tests { | |
let json = format!("\"{}\"", hex); | ||
assert_eq!(::serde_json::to_string(&uint).unwrap(), json); | ||
assert_eq!(::serde_json::from_str::<u256>(&json).unwrap(), uint); | ||
|
||
let bin_encoded = ::bincode::serialize(&uint).unwrap(); | ||
let bin_decoded: u256 = ::bincode::deserialize(&bin_encoded).unwrap(); | ||
assert_eq!(bin_decoded, uint); | ||
}; | ||
|
||
check(u256::from(0u64), "0000000000000000000000000000000000000000000000000000000000000000"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,8 @@ | |
// | ||
// Written in 2014 by | ||
// Andrew Poelstra <[email protected]> | ||
// Updated in 2020-2021 by | ||
// Dr. Maxim Orlovsky <orlovsky@pandoracore.com> | ||
// Updated in 2020-2024 by | ||
// Dr. Maxim Orlovsky <orlovsky@ubideco.org> | ||
// | ||
// To the extent possible under law, the author(s) have dedicated all | ||
// copyright and related and neighboring rights to this software to | ||
|
@@ -17,11 +17,11 @@ | |
|
||
#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug)] | ||
/// Error indicating that a value does not fit integer dimension | ||
pub struct OverflowError { | ||
pub struct OverflowError<T = usize> { | ||
/// Integer bit size | ||
pub max: usize, | ||
pub max: T, | ||
/// Value that overflows | ||
pub value: usize, | ||
pub value: T, | ||
} | ||
|
||
impl core::fmt::Display for OverflowError { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
// Rust language amplification library providing multiple generic trait | ||
// implementations, type wrappers, derive macros and other language enhancements | ||
// | ||
// Written in 2014 by | ||
// Andrew Poelstra <[email protected]> | ||
// Updated in 2020-2021 by | ||
// Dr. Maxim Orlovsky <[email protected]> | ||
// Written in 2020-2024 by | ||
// Dr. Maxim Orlovsky <[email protected]> | ||
// | ||
// To the extent possible under law, the author(s) have dedicated all | ||
// copyright and related and neighboring rights to this software to | ||
|
@@ -17,12 +15,13 @@ | |
|
||
//! Custom-sized numeric types | ||
//! | ||
//! Implementation of a various integer types with custom bit dimension. These | ||
//! Implementation of a various integer types with custom bit dimension. This | ||
//! includes: | ||
//! * large signed and unsigned integers, named *gib int types* (256, 512, | ||
//! * large signed and unsigned integers, named *large int types* (256, 512, | ||
//! 1024-bit) | ||
//! * custom sub-8 bit unsigned integers, named *small int types (5-, 6-, 7-bit) | ||
//! * 24-bit signed integer. | ||
//! * custom sub-8 bit unsigned integers, named *small int types* (from 1 to | ||
//! 7-bit) | ||
//! * 24-, 40-, 48- and 56-bit unsigned integer. | ||
//! | ||
//! The functions here are designed to be fast. | ||
|
||
|
@@ -43,7 +42,7 @@ pub mod posit; | |
mod smallint; | ||
|
||
pub use bigint::{i1024, i256, i512, u1024, u256, u512}; | ||
pub use smallint::{u1, u2, u24, u3, u4, u5, u6, u7}; | ||
pub use smallint::{u1, u2, u24, u3, u4, u40, u48, u5, u56, u6, u7}; | ||
|
||
// TODO: Create arbitrary precision types | ||
// TODO: Move from using `u64` to `u128` for big int types |
Oops, something went wrong.