pub enum StrengthReduceRule {
MulByPow2(u32),
DivByPow2(u32),
ModByPow2(u32),
MulByConstant(u64),
DivByConstant(u64),
Pow2Const,
Pow3Const,
NegToSub,
AddSubToInc,
}Expand description
A single algebraic strength-reduction rewrite rule.
Variants§
MulByPow2(u32)
x * 2^n → x << n.
DivByPow2(u32)
x / 2^n → x >> n (unsigned / logical right shift).
ModByPow2(u32)
x % 2^n → x & (2^n - 1).
MulByConstant(u64)
x * c → sequence of shifts and additions.
DivByConstant(u64)
x / c → multiply-by-reciprocal (magic number division).
Pow2Const
pow(x, 2) → x * x.
Pow3Const
pow(x, 3) → x * x * x.
NegToSub
0 - x → negate(x).
AddSubToInc
x + 1 → incr(x).
Trait Implementations§
Source§impl Clone for StrengthReduceRule
impl Clone for StrengthReduceRule
Source§fn clone(&self) -> StrengthReduceRule
fn clone(&self) -> StrengthReduceRule
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StrengthReduceRule
impl Debug for StrengthReduceRule
Source§impl Display for StrengthReduceRule
impl Display for StrengthReduceRule
Source§impl PartialEq for StrengthReduceRule
impl PartialEq for StrengthReduceRule
impl Eq for StrengthReduceRule
impl StructuralPartialEq for StrengthReduceRule
Auto Trait Implementations§
impl Freeze for StrengthReduceRule
impl RefUnwindSafe for StrengthReduceRule
impl Send for StrengthReduceRule
impl Sync for StrengthReduceRule
impl Unpin for StrengthReduceRule
impl UnsafeUnpin for StrengthReduceRule
impl UnwindSafe for StrengthReduceRule
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
Mutably borrows from an owned value. Read more