@@ -60,23 +60,23 @@ use zeroize::DefaultIsZeroes;
6060/// # Encoding support
6161/// This type supports many different types of encodings, either via the
6262/// [`Encoding`][`crate::Encoding`] trait or various `const fn` decoding and
63- /// encoding functions that can be used with [`UInt `] constants.
63+ /// encoding functions that can be used with [`Uint `] constants.
6464///
6565/// Optional crate features for encoding (off-by-default):
6666/// - `generic-array`: enables [`ArrayEncoding`][`crate::ArrayEncoding`] trait which can be used to
67- /// [`UInt `] as `GenericArray<u8, N>` and a [`ArrayDecoding`][`crate::ArrayDecoding`] trait which
68- /// can be used to `GenericArray<u8, N>` as [`UInt `].
67+ /// [`Uint `] as `GenericArray<u8, N>` and a [`ArrayDecoding`][`crate::ArrayDecoding`] trait which
68+ /// can be used to `GenericArray<u8, N>` as [`Uint `].
6969/// - `rlp`: support for [Recursive Length Prefix (RLP)][RLP] encoding.
7070///
7171/// [RLP]: https://eth.wiki/fundamentals/rlp
7272// TODO(tarcieri): make generic around a specified number of bits.
7373#[ derive( Copy , Clone , Debug , Hash ) ]
74- pub struct UInt < const LIMBS : usize > {
74+ pub struct Uint < const LIMBS : usize > {
7575 /// Inner limb array. Stored from least significant to most significant.
7676 limbs : [ Limb ; LIMBS ] ,
7777}
7878
79- impl < const LIMBS : usize > UInt < LIMBS > {
79+ impl < const LIMBS : usize > Uint < LIMBS > {
8080 /// The value `0`.
8181 pub const ZERO : Self = Self :: from_u8 ( 0 ) ;
8282
@@ -86,17 +86,17 @@ impl<const LIMBS: usize> UInt<LIMBS> {
8686 /// The number of limbs used on this platform.
8787 pub const LIMBS : usize = LIMBS ;
8888
89- /// Maximum value this [`UInt `] can express.
89+ /// Maximum value this [`Uint `] can express.
9090 pub const MAX : Self = Self {
9191 limbs : [ Limb :: MAX ; LIMBS ] ,
9292 } ;
9393
94- /// Const-friendly [`UInt `] constructor.
94+ /// Const-friendly [`Uint `] constructor.
9595 pub const fn new ( limbs : [ Limb ; LIMBS ] ) -> Self {
9696 Self { limbs }
9797 }
9898
99- /// Create a [`UInt `] from an array of [`Word`]s (i.e. word-sized unsigned
99+ /// Create a [`Uint `] from an array of [`Word`]s (i.e. word-sized unsigned
100100 /// integers).
101101 #[ inline]
102102 pub const fn from_words ( arr : [ Word ; LIMBS ] ) -> Self {
@@ -112,7 +112,7 @@ impl<const LIMBS: usize> UInt<LIMBS> {
112112 }
113113
114114 /// Create an array of [`Word`]s (i.e. word-sized unsigned integers) from
115- /// a [`UInt `].
115+ /// a [`Uint `].
116116 #[ inline]
117117 pub const fn to_words ( self ) -> [ Word ; LIMBS ] {
118118 let mut arr = [ 0 ; LIMBS ] ;
@@ -145,52 +145,52 @@ impl<const LIMBS: usize> UInt<LIMBS> {
145145 }
146146 }
147147
148- /// Borrow the limbs of this [`UInt `].
148+ /// Borrow the limbs of this [`Uint `].
149149 // TODO(tarcieri): rename to `as_limbs` for consistency with `as_words`
150150 pub const fn limbs ( & self ) -> & [ Limb ; LIMBS ] {
151151 & self . limbs
152152 }
153153
154- /// Borrow the limbs of this [`UInt `] mutably.
154+ /// Borrow the limbs of this [`Uint `] mutably.
155155 // TODO(tarcieri): rename to `as_limbs_mut` for consistency with `as_words_mut`
156156 pub fn limbs_mut ( & mut self ) -> & mut [ Limb ; LIMBS ] {
157157 & mut self . limbs
158158 }
159159
160- /// Convert this [`UInt `] into its inner limbs.
160+ /// Convert this [`Uint `] into its inner limbs.
161161 // TODO(tarcieri): rename to `to_limbs` for consistency with `to_words`
162162 pub const fn into_limbs ( self ) -> [ Limb ; LIMBS ] {
163163 self . limbs
164164 }
165165}
166166
167- impl < const LIMBS : usize > AsRef < [ Word ; LIMBS ] > for UInt < LIMBS > {
167+ impl < const LIMBS : usize > AsRef < [ Word ; LIMBS ] > for Uint < LIMBS > {
168168 fn as_ref ( & self ) -> & [ Word ; LIMBS ] {
169169 self . as_words ( )
170170 }
171171}
172172
173- impl < const LIMBS : usize > AsMut < [ Word ; LIMBS ] > for UInt < LIMBS > {
173+ impl < const LIMBS : usize > AsMut < [ Word ; LIMBS ] > for Uint < LIMBS > {
174174 fn as_mut ( & mut self ) -> & mut [ Word ; LIMBS ] {
175175 self . as_words_mut ( )
176176 }
177177}
178178
179179// TODO(tarcieri): eventually phase this out in favor of `limbs()`?
180- impl < const LIMBS : usize > AsRef < [ Limb ] > for UInt < LIMBS > {
180+ impl < const LIMBS : usize > AsRef < [ Limb ] > for Uint < LIMBS > {
181181 fn as_ref ( & self ) -> & [ Limb ] {
182182 self . limbs ( )
183183 }
184184}
185185
186186// TODO(tarcieri): eventually phase this out in favor of `limbs_mut()`?
187- impl < const LIMBS : usize > AsMut < [ Limb ] > for UInt < LIMBS > {
187+ impl < const LIMBS : usize > AsMut < [ Limb ] > for Uint < LIMBS > {
188188 fn as_mut ( & mut self ) -> & mut [ Limb ] {
189189 self . limbs_mut ( )
190190 }
191191}
192192
193- impl < const LIMBS : usize > ConditionallySelectable for UInt < LIMBS > {
193+ impl < const LIMBS : usize > ConditionallySelectable for Uint < LIMBS > {
194194 fn conditional_select ( a : & Self , b : & Self , choice : Choice ) -> Self {
195195 let mut limbs = [ Limb :: ZERO ; LIMBS ] ;
196196
@@ -202,13 +202,13 @@ impl<const LIMBS: usize> ConditionallySelectable for UInt<LIMBS> {
202202 }
203203}
204204
205- impl < const LIMBS : usize > Default for UInt < LIMBS > {
205+ impl < const LIMBS : usize > Default for Uint < LIMBS > {
206206 fn default ( ) -> Self {
207207 Self :: ZERO
208208 }
209209}
210210
211- impl < const LIMBS : usize > Integer for UInt < LIMBS > {
211+ impl < const LIMBS : usize > Integer for Uint < LIMBS > {
212212 const ONE : Self = Self :: ONE ;
213213 const MAX : Self = Self :: MAX ;
214214
@@ -220,17 +220,17 @@ impl<const LIMBS: usize> Integer for UInt<LIMBS> {
220220 }
221221}
222222
223- impl < const LIMBS : usize > Zero for UInt < LIMBS > {
223+ impl < const LIMBS : usize > Zero for Uint < LIMBS > {
224224 const ZERO : Self = Self :: ZERO ;
225225}
226226
227- impl < const LIMBS : usize > fmt:: Display for UInt < LIMBS > {
227+ impl < const LIMBS : usize > fmt:: Display for Uint < LIMBS > {
228228 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
229229 fmt:: UpperHex :: fmt ( self , f)
230230 }
231231}
232232
233- impl < const LIMBS : usize > fmt:: LowerHex for UInt < LIMBS > {
233+ impl < const LIMBS : usize > fmt:: LowerHex for Uint < LIMBS > {
234234 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
235235 for limb in self . limbs . iter ( ) . rev ( ) {
236236 fmt:: LowerHex :: fmt ( limb, f) ?;
@@ -239,7 +239,7 @@ impl<const LIMBS: usize> fmt::LowerHex for UInt<LIMBS> {
239239 }
240240}
241241
242- impl < const LIMBS : usize > fmt:: UpperHex for UInt < LIMBS > {
242+ impl < const LIMBS : usize > fmt:: UpperHex for Uint < LIMBS > {
243243 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
244244 for limb in self . limbs . iter ( ) . rev ( ) {
245245 fmt:: UpperHex :: fmt ( limb, f) ?;
@@ -250,9 +250,9 @@ impl<const LIMBS: usize> fmt::UpperHex for UInt<LIMBS> {
250250
251251#[ cfg( feature = "serde" ) ]
252252#[ cfg_attr( docsrs, doc( cfg( feature = "serde" ) ) ) ]
253- impl < ' de , const LIMBS : usize > Deserialize < ' de > for UInt < LIMBS >
253+ impl < ' de , const LIMBS : usize > Deserialize < ' de > for Uint < LIMBS >
254254where
255- UInt < LIMBS > : Encoding ,
255+ Uint < LIMBS > : Encoding ,
256256{
257257 fn deserialize < D > ( deserializer : D ) -> Result < Self , D :: Error >
258258 where
@@ -267,9 +267,9 @@ where
267267
268268#[ cfg( feature = "serde" ) ]
269269#[ cfg_attr( docsrs, doc( cfg( feature = "serde" ) ) ) ]
270- impl < ' de , const LIMBS : usize > Serialize for UInt < LIMBS >
270+ impl < ' de , const LIMBS : usize > Serialize for Uint < LIMBS >
271271where
272- UInt < LIMBS > : Encoding ,
272+ Uint < LIMBS > : Encoding ,
273273{
274274 fn serialize < S > ( & self , serializer : S ) -> Result < S :: Ok , S :: Error >
275275 where
@@ -281,15 +281,15 @@ where
281281
282282#[ cfg( feature = "zeroize" ) ]
283283#[ cfg_attr( docsrs, doc( cfg( feature = "zeroize" ) ) ) ]
284- impl < const LIMBS : usize > DefaultIsZeroes for UInt < LIMBS > { }
284+ impl < const LIMBS : usize > DefaultIsZeroes for Uint < LIMBS > { }
285285
286286// TODO(tarcieri): use `const_evaluatable_checked` when stable to make generic around bits.
287287macro_rules! impl_uint_aliases {
288288 ( $( ( $name: ident, $bits: expr, $doc: expr) ) ,+) => {
289289 $(
290290 #[ doc = $doc]
291291 #[ doc="unsigned big integer." ]
292- pub type $name = UInt <{ nlimbs!( $bits) } >;
292+ pub type $name = Uint <{ nlimbs!( $bits) } >;
293293
294294 impl Encoding for $name {
295295 const BIT_SIZE : usize = $bits;
0 commit comments