Struct Reciprocal
pub struct Reciprocal { /* private fields */ }Expand description
A pre-calculated reciprocal for division by a single limb.
Implementations§
§impl Reciprocal
impl Reciprocal
pub const fn ct_new(divisor: Limb) -> (Reciprocal, CtChoice)
pub const fn ct_new(divisor: Limb) -> (Reciprocal, CtChoice)
Pre-calculates a reciprocal for a known divisor,
to be used in the single-limb division later.
Returns the reciprocal, and the truthy value if divisor != 0
and the falsy value otherwise.
Note: if the returned flag is falsy, the returned reciprocal object is still self-consistent and can be passed to functions here without causing them to panic, but the results are naturally not to be used.
pub const fn default() -> Reciprocal
pub const fn default() -> Reciprocal
Returns a default instance of this object.
It is a self-consistent Reciprocal that will not cause panics in functions that take it.
NOTE: intended for using it as a placeholder during compile-time array generation, don’t rely on the contents.
pub fn new(divisor: Limb) -> CtOption<Reciprocal>
pub fn new(divisor: Limb) -> CtOption<Reciprocal>
A non-const-fn version of new_const(), wrapping the result in a CtOption.
Trait Implementations§
§impl Clone for Reciprocal
impl Clone for Reciprocal
§fn clone(&self) -> Reciprocal
fn clone(&self) -> Reciprocal
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl ConditionallySelectable for Reciprocal
impl ConditionallySelectable for Reciprocal
§fn conditional_select(
a: &Reciprocal,
b: &Reciprocal,
choice: Choice,
) -> Reciprocal
fn conditional_select( a: &Reciprocal, b: &Reciprocal, choice: Choice, ) -> Reciprocal
Source§fn conditional_assign(&mut self, other: &Self, choice: Choice)
fn conditional_assign(&mut self, other: &Self, choice: Choice)
Source§fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
self and other if choice == 1; otherwise,
reassign both unto themselves. Read more§impl Debug for Reciprocal
impl Debug for Reciprocal
§impl Default for Reciprocal
impl Default for Reciprocal
§fn default() -> Reciprocal
fn default() -> Reciprocal
§impl PartialEq for Reciprocal
impl PartialEq for Reciprocal
impl Copy for Reciprocal
impl Eq for Reciprocal
impl StructuralPartialEq for Reciprocal
Auto Trait Implementations§
impl Freeze for Reciprocal
impl RefUnwindSafe for Reciprocal
impl Send for Reciprocal
impl Sync for Reciprocal
impl Unpin for Reciprocal
impl UnwindSafe for Reciprocal
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more