pub struct StrengthReductionPass {
pub reductions: u32,
}Expand description
Strength reduction: replaces expensive operations with cheaper equivalents. For example, multiplication by a power of 2 becomes a left shift.
Fields§
§reductions: u32Implementations§
Source§impl StrengthReductionPass
impl StrengthReductionPass
pub fn new() -> Self
Sourcepub fn is_power_of_two(n: u64) -> bool
pub fn is_power_of_two(n: u64) -> bool
Check if a value is a power of two.
Sourcepub fn log2_exact(n: u64) -> Option<u32>
pub fn log2_exact(n: u64) -> Option<u32>
Compute log2 for a power of two, returning None if not a power of two.
Trait Implementations§
Source§impl Debug for StrengthReductionPass
impl Debug for StrengthReductionPass
Auto Trait Implementations§
impl Freeze for StrengthReductionPass
impl RefUnwindSafe for StrengthReductionPass
impl Send for StrengthReductionPass
impl Sync for StrengthReductionPass
impl Unpin for StrengthReductionPass
impl UnsafeUnpin for StrengthReductionPass
impl UnwindSafe for StrengthReductionPass
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