MCPcopy Create free account
hub / github.com/IntegralPilot/rustc_codegen_jvm / find_primes

Function find_primes

tests/binary/primes/src/main.rs:22–35  ·  view source on GitHub ↗
(start: u32, count: usize, buffer: &mut [u32])

Source from the content-addressed store, hash-verified

20}
21
22fn find_primes(start: u32, count: usize, buffer: &mut [u32]) -> usize {
23 let mut found = 0;
24 let mut candidate = if start % 2 == 0 { start + 1 } else { start };
25
26 while found < count && found < buffer.len() {
27 if is_prime(candidate) {
28 buffer[found] = candidate;
29 found += 1;
30 }
31 candidate += 2;
32 }
33
34 found
35}
36
37fn main() {
38 let mut primes = [0u32; 10];

Callers 1

mainFunction · 0.85

Calls 2

is_primeFunction · 0.85
lenMethod · 0.80

Tested by

no test coverage detected