Lines Matching +full:128 +full:m
166 /// let v = Bounded::<u32, 8>::from(128u8);
167 /// assert_eq!(v.get(), 128);
170 /// let v = Bounded::<i32, 8>::from(-128i8);
171 /// assert_eq!(v.get(), -128);
198 /// let v = Bounded::<i32, 8>::new::<-128>();
199 /// assert_eq!(i8::from(v), -128);
220 /// // Succeeds because `128` fits into 8 bits.
221 /// let v: Option<Bounded<u16, 8>> = 128u32.try_into_bounded();
222 /// assert_eq!(v.as_deref().copied(), Some(128));
224 /// // Fails because `128` doesn't fits into 6 bits.
225 /// let v: Option<Bounded<u16, 6>> = 128u32.try_into_bounded();
405 pub const fn extend<const M: u32>(self) -> Bounded<T, M> { in extend() argument
408 M >= N, in extend()
414 // the larger `M` bits. in extend()
420 /// Returns [`None`] if the value of `self` cannot be represented within `M` bits.
436 pub fn try_shrink<const M: u32>(self) -> Option<Bounded<T, M>> { in try_shrink() argument
437 Bounded::<T, M>::try_new(self.get()) in try_shrink()
500 /// // Succeeds because `128` fits into 8 bits.
501 /// let v: Option<Bounded<u16, 8>> = 128u32.try_into_bounded();
502 /// assert_eq!(v.as_deref().copied(), Some(128));
504 /// // Fails because `128` doesn't fits into 6 bits.
505 /// let v: Option<Bounded<u16, 6>> = 128u32.try_into_bounded();
528 impl<T, U, const N: u32, const M: u32> PartialEq<Bounded<U, M>> for Bounded<T, N>
534 fn eq(&self, other: &Bounded<U, M>) -> bool { in eq()
541 impl<T, U, const N: u32, const M: u32> PartialOrd<Bounded<U, M>> for Bounded<T, N>
547 fn partial_cmp(&self, other: &Bounded<U, M>) -> Option<cmp::Ordering> { in partial_cmp()
586 impl<T, const N: u32, const M: u32> ops::Add<Bounded<T, M>> for Bounded<T, N>
593 fn add(self, rhs: Bounded<T, M>) -> Self::Output { in add()
598 impl<T, const N: u32, const M: u32> ops::BitAnd<Bounded<T, M>> for Bounded<T, N>
605 fn bitand(self, rhs: Bounded<T, M>) -> Self::Output { in bitand()
610 impl<T, const N: u32, const M: u32> ops::BitOr<Bounded<T, M>> for Bounded<T, N>
617 fn bitor(self, rhs: Bounded<T, M>) -> Self::Output { in bitor()
622 impl<T, const N: u32, const M: u32> ops::BitXor<Bounded<T, M>> for Bounded<T, N>
629 fn bitxor(self, rhs: Bounded<T, M>) -> Self::Output { in bitxor()
634 impl<T, const N: u32, const M: u32> ops::Div<Bounded<T, M>> for Bounded<T, N>
641 fn div(self, rhs: Bounded<T, M>) -> Self::Output { in div()
646 impl<T, const N: u32, const M: u32> ops::Mul<Bounded<T, M>> for Bounded<T, N>
653 fn mul(self, rhs: Bounded<T, M>) -> Self::Output { in mul()
658 impl<T, const N: u32, const M: u32> ops::Rem<Bounded<T, M>> for Bounded<T, N>
665 fn rem(self, rhs: Bounded<T, M>) -> Self::Output { in rem()
670 impl<T, const N: u32, const M: u32> ops::Sub<Bounded<T, M>> for Bounded<T, N>
677 fn sub(self, rhs: Bounded<T, M>) -> Self::Output { in sub()