Struct rsa_cortex_m4::arithmetic::Wrapping [−][src]
Intentionally-wrapped arithmetic.
We can't use core::num::Wrapping
due to type coherence clashing
with our usage requirements.
The idea is that T
is [Number
], and we wrap around $2^N$ where N = T::BITS
.
Implementations
impl<const D: usize, const E: usize> Wrapping<Unsigned<D, E>>
[src]
Trait Implementations
impl<const D: usize, const E: usize> Add<&'_ Wrapping<Unsigned<D, E>>> for &Wrapping<Unsigned<D, E>>
[src]
type Output = Wrapping<Unsigned<D, E>>
The resulting type after applying the +
operator.
fn add(self, summand: Self) -> Self::Output
[src]
impl<const D: usize, const E: usize> AddAssign<&'_ Wrapping<Unsigned<D, E>>> for Wrapping<Unsigned<D, E>>
[src]
fn add_assign(&mut self, summand: &Self)
[src]
impl<T: Clone> Clone for Wrapping<T>
[src]
fn clone(&self) -> Wrapping<T>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug> Debug for Wrapping<T>
[src]
impl<T: Default> Default for Wrapping<T>
[src]
impl<T: Number> Deref for Wrapping<T>
[src]
impl<T: Number + NumberMut> DerefMut for Wrapping<T>
[src]
impl<const D: usize, const E: usize> Mul<&'_ Wrapping<Unsigned<D, E>>> for &Wrapping<Unsigned<D, E>>
[src]
type Output = Wrapping<Unsigned<D, E>>
The resulting type after applying the *
operator.
fn mul(self, other: Self) -> Self::Output
[src]
impl<const D: usize, const E: usize> Neg for &Wrapping<Unsigned<D, E>>
[src]
type Output = Wrapping<Unsigned<D, E>>
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
impl<T: Number> Number for Wrapping<T>
[src]
const BITS: usize
[src]
const DIGITS: usize
[src]
fn significant_digits(&self) -> &[Digit]
[src]
fn leading_digit(&self) -> Option<Digit>
[src]
fn to_unsigned<const D: usize, const E: usize>(&self) -> Result<Unsigned<D, E>>
[src]
fn zero() -> Self
[src]
fn is_zero(&self) -> bool
[src]
fn is_one(&self) -> bool
[src]
fn is_digit(&self) -> bool
[src]
fn is_odd(&self) -> bool
[src]
fn cmp(&self, other: &impl Number) -> Ordering
[src]
fn eq(&self, other: &impl Number) -> bool
[src]
fn deref(&self) -> &[Digit]
[src]
fn deref_mut(&mut self) -> &mut Self::Target
[src]
impl<T: Number + NumberMut> NumberMut for Wrapping<T>
[src]
fn from_slice(slice: &[Digit]) -> Self
[src]
fn try_from_slice(slice: &[Digit]) -> Result<Self>
[src]
fn from_bytes(bytes: &[u8]) -> Self
[src]
fn set_zero(&mut self)
[src]
fn one() -> Self
[src]
fn swap_order(self) -> Self
[src]
fn random(rng: impl CryptoRng + RngCore) -> Self
[src]
impl<T: PartialEq> PartialEq<Wrapping<T>> for Wrapping<T>
[src]
impl<T> RefCast for Wrapping<T>
[src]
type From = T
fn ref_cast(_from: &Self::From) -> &Self
[src]
fn ref_cast_mut(_from: &mut Self::From) -> &mut Self
[src]
impl<T> StructuralPartialEq for Wrapping<T>
[src]
impl<const D: usize, const E: usize, const L: usize> Sub<&'_ Wrapping<Array<D, E, L>>> for &Wrapping<Array<D, E, L>>
[src]
type Output = Wrapping<Array<D, E, L>>
The resulting type after applying the -
operator.
fn sub(self, other: Self) -> Self::Output
[src]
impl<const D: usize, const E: usize> Sub<&'_ Wrapping<Unsigned<D, E>>> for &Wrapping<Unsigned<D, E>>
[src]
type Output = Wrapping<Unsigned<D, E>>
The resulting type after applying the -
operator.
fn sub(self, subtrahend: Self) -> Self::Output
[src]
impl<T, const D: usize, const E: usize> SubAssign<&'_ T> for Wrapping<Unsigned<D, E>> where
T: Number,
[src]
T: Number,
TODO: This implementation (and the analogous one for Array) needs to be properly tested/fuzzed.
It's implemented more generally than for just T = Unsigned<D, E> as we need that in `crate::arithmetic::divide::generic_div_rem.
There, we want to implement for any (dividend, divisor) pair. The only real work is done for dividend > divisor, implying that dividend.len() >= divisor.len(), and, where we're called, minuend >= subtrahend, and hence minuend.len() >= subtrahend.len().
This is needed to make the implementation of sub_assign_borrow (with dropped borrow) valid.
fn sub_assign(&mut self, subtrahend: &T)
[src]
impl<T, const D: usize, const E: usize, const L: usize> SubAssign<&'_ T> for Wrapping<Array<D, E, L>> where
T: Number,
[src]
T: Number,
TODO: See remark about SubAssign for Unsigned<D, E>
fn sub_assign(&mut self, other: &T)
[src]
Auto Trait Implementations
impl<T> Send for Wrapping<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Wrapping<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for Wrapping<T> where
T: Unpin,
[src]
T: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Bits for T where
T: Number,
[src]
T: Number,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,