From 1cbb52176f78516dee329c739b474ea2ee8f6d8a Mon Sep 17 00:00:00 2001 From: Bryant Eisenbach Date: Tue, 6 Aug 2019 19:35:22 -0400 Subject: [PATCH 1/4] bug: Modified AsRef impl for U-type macros - Potential bug with current implementation that led to unused API - Replaced with useful internal getter for &[u64] types Fixes: #195 --- uint/src/uint.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/uint/src/uint.rs b/uint/src/uint.rs index 6dcdb4fd0..85c7910cb 100644 --- a/uint/src/uint.rs +++ b/uint/src/uint.rs @@ -424,9 +424,10 @@ macro_rules! construct_uint { #[derive(Copy, Clone, Eq, PartialEq, Hash)] $visibility struct $name (pub [u64; $n_words]); - impl AsRef<$name> for $name { - fn as_ref(&self) -> &$name { - &self + impl AsRef<[u64]> for $name { + #[inline] + fn as_ref(&self) -> &[u64] { + &self.0 } } From 7173e435c1e79dcbfe9b5453e25d3407c5f6e613 Mon Sep 17 00:00:00 2001 From: Bryant Eisenbach Date: Wed, 7 Aug 2019 08:44:57 -0400 Subject: [PATCH 2/4] format: Whitespace Co-Authored-By: Wei Tang --- uint/src/uint.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uint/src/uint.rs b/uint/src/uint.rs index 85c7910cb..68f9199b5 100644 --- a/uint/src/uint.rs +++ b/uint/src/uint.rs @@ -425,7 +425,7 @@ macro_rules! construct_uint { $visibility struct $name (pub [u64; $n_words]); impl AsRef<[u64]> for $name { - #[inline] + #[inline] fn as_ref(&self) -> &[u64] { &self.0 } From 5b65cd20f739d86f4bc926328f7d54006f6783ce Mon Sep 17 00:00:00 2001 From: Bryant Eisenbach Date: Wed, 7 Aug 2019 09:29:35 -0400 Subject: [PATCH 3/4] format: Whitespace Co-Authored-By: Andronik Ordian --- uint/src/uint.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uint/src/uint.rs b/uint/src/uint.rs index 68f9199b5..251800213 100644 --- a/uint/src/uint.rs +++ b/uint/src/uint.rs @@ -425,7 +425,7 @@ macro_rules! construct_uint { $visibility struct $name (pub [u64; $n_words]); impl AsRef<[u64]> for $name { - #[inline] + #[inline] fn as_ref(&self) -> &[u64] { &self.0 } From b74f4cd77e87564c7064c064ed1388f55bcdad94 Mon Sep 17 00:00:00 2001 From: Bryant Eisenbach Date: Fri, 9 Aug 2019 10:45:25 -0400 Subject: [PATCH 4/4] doc: Suggestion from review Co-Authored-By: Andronik Ordian --- uint/src/uint.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/uint/src/uint.rs b/uint/src/uint.rs index 251800213..3fc1296c3 100644 --- a/uint/src/uint.rs +++ b/uint/src/uint.rs @@ -424,6 +424,7 @@ macro_rules! construct_uint { #[derive(Copy, Clone, Eq, PartialEq, Hash)] $visibility struct $name (pub [u64; $n_words]); + /// Get a reference to the underlying little-endian words. impl AsRef<[u64]> for $name { #[inline] fn as_ref(&self) -> &[u64] {