Struct strength_reduce::StrengthReducedU64
source · pub struct StrengthReducedU64 { /* private fields */ }
Expand description
Implements unsigned division and modulo via mutiplication and shifts.
Creating a an instance of this struct is more expensive than a single division, but if the division is repeated, this version will be several times faster than naive division.
Implementations
sourceimpl StrengthReducedU64
impl StrengthReducedU64
sourcepub fn new(divisor: u64) -> Self
pub fn new(divisor: u64) -> Self
Creates a new divisor instance.
If possible, avoid calling new() from an inner loop: The intended usage is to create an instance of this struct outside the loop, and use it for divison and remainders inside the loop.
Panics:
Panics if divisor
is 0
Trait Implementations
sourceimpl Clone for StrengthReducedU64
impl Clone for StrengthReducedU64
sourcefn clone(&self) -> StrengthReducedU64
fn clone(&self) -> StrengthReducedU64
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for StrengthReducedU64
impl Debug for StrengthReducedU64
sourceimpl Div<StrengthReducedU64> for u64
impl Div<StrengthReducedU64> for u64
sourceimpl Rem<StrengthReducedU64> for u64
impl Rem<StrengthReducedU64> for u64
impl Copy for StrengthReducedU64
Auto Trait Implementations
impl RefUnwindSafe for StrengthReducedU64
impl Send for StrengthReducedU64
impl Sync for StrengthReducedU64
impl Unpin for StrengthReducedU64
impl UnwindSafe for StrengthReducedU64
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more