struct Wheel {
mask: Vec<u64>,
product: u32,
}Fields§
§mask: Vec<u64>§product: u32Implementations§
Source§impl Wheel
impl Wheel
Sourcefn new(primes: &[u32], product: u32) -> Self
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(¤t, 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> 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