Skip to main content

Wheel

Struct Wheel 

Source
struct Wheel {
    mask: Vec<u64>,
    product: u32,
}

Fields§

§mask: Vec<u64>§product: u32

Implementations§

Source§

impl Wheel

Source

fn new(primes: &[u32], product: u32) -> Self

Examples found in repository?
crates/competitive/src/math/prime_list.rs (line 172)
164fn make_wheels() -> (Vec<Wheel>, usize) {
165    const MAX_WHEEL_SIZE: u32 = 1 << 20;
166    const BASE: u32 = (PERIOD * 64) >> (WHEEL_PRIMES.len() - 2);
167    let mut product = BASE;
168    let mut current = vec![];
169    let mut wheels = vec![];
170    for (i, &p) in SQRT_PRIMES.iter().enumerate() {
171        if product * p > MAX_WHEEL_SIZE {
172            wheels.push(Wheel::new(&current, product));
173            current.clear();
174            current.push(p);
175            product = BASE * p;
176            if product > MAX_WHEEL_SIZE {
177                return (wheels, i);
178            }
179        } else {
180            current.push(p);
181            product *= p;
182        }
183    }
184    unreachable!()
185}

Auto Trait Implementations§

§

impl Freeze for Wheel

§

impl RefUnwindSafe for Wheel

§

impl Send for Wheel

§

impl Sync for Wheel

§

impl Unpin for Wheel

§

impl UnsafeUnpin for Wheel

§

impl UnwindSafe for Wheel

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToArrayVecScalar for T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.