line |
true |
false |
branch |
21
|
11 |
4743 |
if ( (startp > UVCONST( 100000000000000) && range < 40000) || |
|
0 |
11 |
if ( (startp > UVCONST( 100000000000000) && range < 40000) || |
|
0 |
4743 |
if ( (startp > UVCONST( 100000000000000) && range < 40000) || |
22
|
0 |
0 |
(startp > UVCONST( 1000000000000000) && range < 150000) || |
|
0 |
4743 |
(startp > UVCONST( 1000000000000000) && range < 150000) || |
23
|
0 |
0 |
(startp > UVCONST( 10000000000000000) && range < 600000) || |
|
0 |
4743 |
(startp > UVCONST( 10000000000000000) && range < 600000) || |
24
|
0 |
0 |
(startp > UVCONST( 100000000000000000) && range < 2500000) || |
|
0 |
4743 |
(startp > UVCONST( 100000000000000000) && range < 2500000) || |
25
|
0 |
0 |
(startp > UVCONST( 1000000000000000000) && range < 10000000) || |
|
0 |
4743 |
(startp > UVCONST( 1000000000000000000) && range < 10000000) || |
26
|
0 |
0 |
(startp > UVCONST(10000000000000000000) && range < 40000000) ) |
123
|
3683 |
368 |
if (to < from) |
125
|
0 |
4051 |
if (dst != src) |
127
|
1806 |
4051 |
while (from < to) { |
128
|
368 |
1438 |
size_t bytes = (2*from > to) ? to-from : from; |
138
|
4845 |
0 |
MPUassert( (mem != 0) && (endd >= startd), "sieve_prefill bad arguments"); |
|
0 |
4845 |
MPUassert( (mem != 0) && (endd >= startd), "sieve_prefill bad arguments"); |
140
|
1070 |
3775 |
if (startd != 0) { |
143
|
794 |
276 |
if (tailbytes > nbytes) tailbytes = nbytes; |
148
|
4051 |
794 |
if (nbytes > 0) { |
151
|
3775 |
276 |
if (startd == 0) mem[0] = 0x01; /* Correct first byte */ |
200
|
18542 |
4266602 |
if (startp == 0) { |
205
|
4259418 |
7184 |
if (p2 < startp) { |
221
|
4112889 |
286994 |
if (w->offset >= bytes) { |
228
|
2879 |
24427 |
CROSS_INDEX( 0, 0,1,2,3,4,5,6,7, 0,0,0,0,0,0,0,1, 1); break; |
|
6215 |
23813 |
CROSS_INDEX( 0, 0,1,2,3,4,5,6,7, 0,0,0,0,0,0,0,1, 1); break; |
|
4594 |
23450 |
CROSS_INDEX( 0, 0,1,2,3,4,5,6,7, 0,0,0,0,0,0,0,1, 1); break; |
|
2627 |
23250 |
CROSS_INDEX( 0, 0,1,2,3,4,5,6,7, 0,0,0,0,0,0,0,1, 1); break; |
|
4680 |
22787 |
CROSS_INDEX( 0, 0,1,2,3,4,5,6,7, 0,0,0,0,0,0,0,1, 1); break; |
|
2763 |
22542 |
CROSS_INDEX( 0, 0,1,2,3,4,5,6,7, 0,0,0,0,0,0,0,1, 1); break; |
|
4327 |
22375 |
CROSS_INDEX( 0, 0,1,2,3,4,5,6,7, 0,0,0,0,0,0,0,1, 1); break; |
|
6397 |
21850 |
CROSS_INDEX( 0, 0,1,2,3,4,5,6,7, 0,0,0,0,0,0,0,1, 1); break; |
|
1598367 |
21850 |
CROSS_INDEX( 0, 0,1,2,3,4,5,6,7, 0,0,0,0,0,0,0,1, 1); break; |
229
|
2840 |
22832 |
CROSS_INDEX( 8, 1,5,4,0,7,3,2,6, 1,1,1,0,1,1,1,1, 7); break; |
|
6508 |
25114 |
CROSS_INDEX( 8, 1,5,4,0,7,3,2,6, 1,1,1,0,1,1,1,1, 7); break; |
|
5050 |
24453 |
CROSS_INDEX( 8, 1,5,4,0,7,3,2,6, 1,1,1,0,1,1,1,1, 7); break; |
|
2715 |
24330 |
CROSS_INDEX( 8, 1,5,4,0,7,3,2,6, 1,1,1,0,1,1,1,1, 7); break; |
|
4600 |
24215 |
CROSS_INDEX( 8, 1,5,4,0,7,3,2,6, 1,1,1,0,1,1,1,1, 7); break; |
|
2796 |
24028 |
CROSS_INDEX( 8, 1,5,4,0,7,3,2,6, 1,1,1,0,1,1,1,1, 7); break; |
|
4825 |
23626 |
CROSS_INDEX( 8, 1,5,4,0,7,3,2,6, 1,1,1,0,1,1,1,1, 7); break; |
|
6508 |
23077 |
CROSS_INDEX( 8, 1,5,4,0,7,3,2,6, 1,1,1,0,1,1,1,1, 7); break; |
|
1686394 |
23077 |
CROSS_INDEX( 8, 1,5,4,0,7,3,2,6, 1,1,1,0,1,1,1,1, 7); break; |
230
|
2782 |
22995 |
CROSS_INDEX(16, 2,4,0,6,1,7,3,5, 2,2,0,2,0,2,2,1, 11); break; |
|
6704 |
22353 |
CROSS_INDEX(16, 2,4,0,6,1,7,3,5, 2,2,0,2,0,2,2,1, 11); break; |
|
4903 |
24590 |
CROSS_INDEX(16, 2,4,0,6,1,7,3,5, 2,2,0,2,0,2,2,1, 11); break; |
|
2762 |
24341 |
CROSS_INDEX(16, 2,4,0,6,1,7,3,5, 2,2,0,2,0,2,2,1, 11); break; |
|
4968 |
23730 |
CROSS_INDEX(16, 2,4,0,6,1,7,3,5, 2,2,0,2,0,2,2,1, 11); break; |
|
2572 |
23730 |
CROSS_INDEX(16, 2,4,0,6,1,7,3,5, 2,2,0,2,0,2,2,1, 11); break; |
|
4740 |
23383 |
CROSS_INDEX(16, 2,4,0,6,1,7,3,5, 2,2,0,2,0,2,2,1, 11); break; |
|
6366 |
23117 |
CROSS_INDEX(16, 2,4,0,6,1,7,3,5, 2,2,0,2,0,2,2,1, 11); break; |
|
1604757 |
23117 |
CROSS_INDEX(16, 2,4,0,6,1,7,3,5, 2,2,0,2,0,2,2,1, 11); break; |
231
|
2884 |
22716 |
CROSS_INDEX(24, 3,0,6,5,2,1,7,4, 3,1,1,2,1,1,3,1, 13); break; |
|
6586 |
22101 |
CROSS_INDEX(24, 3,0,6,5,2,1,7,4, 3,1,1,2,1,1,3,1, 13); break; |
|
4583 |
21711 |
CROSS_INDEX(24, 3,0,6,5,2,1,7,4, 3,1,1,2,1,1,3,1, 13); break; |
|
2842 |
24207 |
CROSS_INDEX(24, 3,0,6,5,2,1,7,4, 3,1,1,2,1,1,3,1, 13); break; |
|
4660 |
23925 |
CROSS_INDEX(24, 3,0,6,5,2,1,7,4, 3,1,1,2,1,1,3,1, 13); break; |
|
2738 |
23742 |
CROSS_INDEX(24, 3,0,6,5,2,1,7,4, 3,1,1,2,1,1,3,1, 13); break; |
|
4789 |
23545 |
CROSS_INDEX(24, 3,0,6,5,2,1,7,4, 3,1,1,2,1,1,3,1, 13); break; |
|
6652 |
22955 |
CROSS_INDEX(24, 3,0,6,5,2,1,7,4, 3,1,1,2,1,1,3,1, 13); break; |
|
1552893 |
22955 |
CROSS_INDEX(24, 3,0,6,5,2,1,7,4, 3,1,1,2,1,1,3,1, 13); break; |
232
|
2913 |
23813 |
CROSS_INDEX(32, 4,7,1,2,5,6,0,3, 3,3,1,2,1,3,3,1, 17); break; |
|
6782 |
23191 |
CROSS_INDEX(32, 4,7,1,2,5,6,0,3, 3,3,1,2,1,3,3,1, 17); break; |
|
4967 |
22761 |
CROSS_INDEX(32, 4,7,1,2,5,6,0,3, 3,3,1,2,1,3,3,1, 17); break; |
|
2878 |
22464 |
CROSS_INDEX(32, 4,7,1,2,5,6,0,3, 3,3,1,2,1,3,3,1, 17); break; |
|
4785 |
26192 |
CROSS_INDEX(32, 4,7,1,2,5,6,0,3, 3,3,1,2,1,3,3,1, 17); break; |
|
2853 |
25983 |
CROSS_INDEX(32, 4,7,1,2,5,6,0,3, 3,3,1,2,1,3,3,1, 17); break; |
|
5179 |
25160 |
CROSS_INDEX(32, 4,7,1,2,5,6,0,3, 3,3,1,2,1,3,3,1, 17); break; |
|
6888 |
24104 |
CROSS_INDEX(32, 4,7,1,2,5,6,0,3, 3,3,1,2,1,3,3,1, 17); break; |
|
2291803 |
24104 |
CROSS_INDEX(32, 4,7,1,2,5,6,0,3, 3,3,1,2,1,3,3,1, 17); break; |
233
|
2626 |
22200 |
CROSS_INDEX(40, 5,3,7,1,6,0,4,2, 4,2,2,2,2,2,4,1, 19); break; |
|
6058 |
21766 |
CROSS_INDEX(40, 5,3,7,1,6,0,4,2, 4,2,2,2,2,2,4,1, 19); break; |
|
4643 |
21230 |
CROSS_INDEX(40, 5,3,7,1,6,0,4,2, 4,2,2,2,2,2,4,1, 19); break; |
|
2867 |
20895 |
CROSS_INDEX(40, 5,3,7,1,6,0,4,2, 4,2,2,2,2,2,4,1, 19); break; |
|
4597 |
20579 |
CROSS_INDEX(40, 5,3,7,1,6,0,4,2, 4,2,2,2,2,2,4,1, 19); break; |
|
2946 |
23790 |
CROSS_INDEX(40, 5,3,7,1,6,0,4,2, 4,2,2,2,2,2,4,1, 19); break; |
|
4849 |
23212 |
CROSS_INDEX(40, 5,3,7,1,6,0,4,2, 4,2,2,2,2,2,4,1, 19); break; |
|
6518 |
22386 |
CROSS_INDEX(40, 5,3,7,1,6,0,4,2, 4,2,2,2,2,2,4,1, 19); break; |
|
1910739 |
22386 |
CROSS_INDEX(40, 5,3,7,1,6,0,4,2, 4,2,2,2,2,2,4,1, 19); break; |
234
|
2712 |
23586 |
CROSS_INDEX(48, 6,2,3,7,0,4,5,1, 5,3,1,4,1,3,5,1, 23); break; |
|
6716 |
22836 |
CROSS_INDEX(48, 6,2,3,7,0,4,5,1, 5,3,1,4,1,3,5,1, 23); break; |
|
4904 |
22223 |
CROSS_INDEX(48, 6,2,3,7,0,4,5,1, 5,3,1,4,1,3,5,1, 23); break; |
|
2771 |
21984 |
CROSS_INDEX(48, 6,2,3,7,0,4,5,1, 5,3,1,4,1,3,5,1, 23); break; |
|
5030 |
21550 |
CROSS_INDEX(48, 6,2,3,7,0,4,5,1, 5,3,1,4,1,3,5,1, 23); break; |
|
2845 |
21325 |
CROSS_INDEX(48, 6,2,3,7,0,4,5,1, 5,3,1,4,1,3,5,1, 23); break; |
|
4761 |
24567 |
CROSS_INDEX(48, 6,2,3,7,0,4,5,1, 5,3,1,4,1,3,5,1, 23); break; |
|
7003 |
23791 |
CROSS_INDEX(48, 6,2,3,7,0,4,5,1, 5,3,1,4,1,3,5,1, 23); break; |
|
2055421 |
23791 |
CROSS_INDEX(48, 6,2,3,7,0,4,5,1, 5,3,1,4,1,3,5,1, 23); break; |
235
|
2750 |
23303 |
CROSS_INDEX(56, 7,6,5,4,3,2,1,0, 6,4,2,4,2,4,6,1, 29); break; |
|
6897 |
22454 |
CROSS_INDEX(56, 7,6,5,4,3,2,1,0, 6,4,2,4,2,4,6,1, 29); break; |
|
4839 |
22026 |
CROSS_INDEX(56, 7,6,5,4,3,2,1,0, 6,4,2,4,2,4,6,1, 29); break; |
|
2780 |
21885 |
CROSS_INDEX(56, 7,6,5,4,3,2,1,0, 6,4,2,4,2,4,6,1, 29); break; |
|
4782 |
21475 |
CROSS_INDEX(56, 7,6,5,4,3,2,1,0, 6,4,2,4,2,4,6,1, 29); break; |
|
2721 |
21235 |
CROSS_INDEX(56, 7,6,5,4,3,2,1,0, 6,4,2,4,2,4,6,1, 29); break; |
|
4737 |
20843 |
CROSS_INDEX(56, 7,6,5,4,3,2,1,0, 6,4,2,4,2,4,6,1, 29); break; |
|
6542 |
23449 |
CROSS_INDEX(56, 7,6,5,4,3,2,1,0, 6,4,2,4,2,4,6,1, 29); break; |
|
1823429 |
23449 |
CROSS_INDEX(56, 7,6,5,4,3,2,1,0, 6,4,2,4,2,4,6,1, 29); break; |
256
|
13790 |
125 |
for ( ; prime <= limit; prime = next_prime_in_sieve(mem,prime,end)) { |
264
|
6882 |
0 |
START_DO_FOR_EACH_SIEVE_PRIME(mem, 0, 0, endp-startp) { |
|
11 |
6871 |
START_DO_FOR_EACH_SIEVE_PRIME(mem, 0, 0, endp-startp) { |
|
6871 |
0 |
START_DO_FOR_EACH_SIEVE_PRIME(mem, 0, 0, endp-startp) { |
|
6882 |
594 |
START_DO_FOR_EACH_SIEVE_PRIME(mem, 0, 0, endp-startp) { |
|
605 |
11 |
START_DO_FOR_EACH_SIEVE_PRIME(mem, 0, 0, endp-startp) { |
265
|
2789 |
4082 |
if (!BPSW(startp + p)) /* If the candidate is not prime, */ |
272
|
77228 |
0 |
START_DO_FOR_EACH_SIEVE_PRIME(sieve, 0, start_base_prime, limit) { /* Sieve */ |
|
23 |
77205 |
START_DO_FOR_EACH_SIEVE_PRIME(sieve, 0, start_base_prime, limit) { /* Sieve */ |
|
77136 |
69 |
START_DO_FOR_EACH_SIEVE_PRIME(sieve, 0, start_base_prime, limit) { /* Sieve */ |
|
77228 |
3685 |
START_DO_FOR_EACH_SIEVE_PRIME(sieve, 0, start_base_prime, limit) { /* Sieve */ |
|
3708 |
23 |
START_DO_FOR_EACH_SIEVE_PRIME(sieve, 0, start_base_prime, limit) { /* Sieve */ |
281
|
0 |
0 |
UV startp = 30*startd, endp = (endd >= (UV_MAX/30)) ? UV_MAX-2 : 30*endd+29; |
283
|
0 |
0 |
MPUassert(mem != 0 && endd >= startd && endp >= startp && depth >= 13, |
|
0 |
0 |
MPUassert(mem != 0 && endd >= startd && endp >= startp && depth >= 13, |
|
0 |
0 |
MPUassert(mem != 0 && endd >= startd && endp >= startp && depth >= 13, |
|
0 |
0 |
MPUassert(mem != 0 && endd >= startd && endp >= startp && depth >= 13, |
286
|
0 |
0 |
if (limit > max_sieve_prime) limit = max_sieve_prime; |
287
|
0 |
0 |
if (limit > depth) limit = depth; |
298
|
269 |
0 |
UV startp = 30*startd, endp = (endd >= (UV_MAX/30)) ? UV_MAX-2 : 30*endd+29; |
301
|
269 |
0 |
MPUassert(mem != 0 && endd >= startd && endp >= startp, |
|
269 |
0 |
MPUassert(mem != 0 && endd >= startd && endp >= startp, |
|
0 |
269 |
MPUassert(mem != 0 && endd >= startd && endp >= startp, |
306
|
246 |
23 |
if (sieve_size >= endp) { |
312
|
23 |
0 |
} else if (!do_partial && sieve_size >= limit) { |
|
23 |
0 |
} else if (!do_partial && sieve_size >= limit) { |
321
|
0 |
0 |
if (do_partial) |
322
|
0 |
0 |
limit >>= ((startp < (UV)1e16) ? 8 : 10); |
329
|
0 |
0 |
if (do_partial) |
341
|
4697 |
0 |
UV endp = (endd >= (UV_MAX/30)) ? UV_MAX-2 : 30*endd+29; |
342
|
4697 |
0 |
MPUassert(mem != 0 && endd >= startd && endp >= startp, |
|
4697 |
0 |
MPUassert(mem != 0 && endd >= startd && endp >= startp, |
|
0 |
4697 |
MPUassert(mem != 0 && endd >= startd && endp >= startp, |
349
|
27104 |
2789 |
while (i < wsize && warray[i].prime < start_base_prime) |
|
25196 |
1908 |
while (i < wsize && warray[i].prime < start_base_prime) |
353
|
0 |
4697 |
if (limit > max_sieve_prime) limit = max_sieve_prime; |
355
|
4310854 |
2800 |
while (i < wsize && warray[i].prime <= limit) { |
|
4308957 |
1897 |
while (i < wsize && warray[i].prime <= limit) { |
356
|
4194218 |
114739 |
if (warray[i].index >= 64) |
361
|
11 |
4686 |
if (limit > warray[wsize-1].prime && warray[wsize-1].prime < max_sieve_prime) |
|
11 |
0 |
if (limit > warray[wsize-1].prime && warray[wsize-1].prime < max_sieve_prime) |
371
|
0 |
4485 |
if (n < 5) return 0 + (n>1) + (n>2); |
372
|
4468 |
17 |
if (n < 355991) pc = n / (logn-1.112); |
373
|
17 |
0 |
else if (n < 2953652287U) pc = n / logn * (1 + 1/logn + 2.51 / (logn*logn)); |
413
|
0 |
4485 |
MPUassert( high >= low, "start_segment_primes bad arguments"); |
419
|
4485 |
0 |
ctx->endp = (ctx->hid >= (UV_MAX/30)) ? UV_MAX-2 : 30*ctx->hid+29; |
423
|
26 |
4459 |
if (high > 1e10 && range > 32*1024-16) { |
|
0 |
26 |
if (high > 1e10 && range > 32*1024-16) { |
427
|
0 |
0 |
if (size < 128*1024) size = 128*1024; |
430
|
0 |
0 |
size = (div <= 1) ? range : (range+div-1)/div; |
439
|
0 |
4485 |
MPUverbose(3, "segment sieve: byte range %lu split into %lu segments of size %lu\n", (unsigned long)range, (unsigned long)nsegments, (unsigned long)ctx->segment_size); |
454
|
11 |
4474 |
if (do_partial_sieve(low, high)) |
455
|
5 |
6 |
limit >>= ((low < (UV)1e16) ? 8 : 10); |
456
|
4485 |
0 |
if (limit <= maxsieve) { |
461
|
0 |
4485 |
MPUverbose(4, "segment sieve %lu - %lu, primes to %lu (max %lu)\n", (unsigned long)low, (unsigned long)high, (unsigned long)limit, (unsigned long)nprimes); |
462
|
0 |
4485 |
New(0, warray, nprimes, wheel_t); |
463
|
0 |
4485 |
START_DO_FOR_EACH_PRIME(0,limit) { |
|
13455 |
4210857 |
START_DO_FOR_EACH_PRIME(0,limit) { |
|
8970 |
4485 |
START_DO_FOR_EACH_PRIME(0,limit) { |
|
4485 |
4485 |
START_DO_FOR_EACH_PRIME(0,limit) { |
|
1830151 |
2380706 |
START_DO_FOR_EACH_PRIME(0,limit) { |
|
539 |
1984499 |
START_DO_FOR_EACH_PRIME(0,limit) { |
|
154887 |
1829612 |
START_DO_FOR_EACH_PRIME(0,limit) { |
|
539 |
1829612 |
START_DO_FOR_EACH_PRIME(0,limit) { |
|
0 |
4210318 |
START_DO_FOR_EACH_PRIME(0,limit) { |
|
3946 |
4219827 |
START_DO_FOR_EACH_PRIME(0,limit) { |
464
|
0 |
4219827 |
if (wsize >= nprimes) croak("segment bad upper count"); |
482
|
4412 |
4697 |
if (ctx->lod > ctx->hid) return 0; |
486
|
4485 |
212 |
: (ctx->lod + ctx->segment_size - 1); |
489
|
4485 |
212 |
*high = (seghigh_d == ctx->hid) ? ctx->high : (seghigh_d*30 + 29); |
492
|
0 |
4697 |
MPUassert( seghigh_d >= ctx->lod, "next_segment_primes: highd < lowd"); |
493
|
0 |
4697 |
MPUassert( range_d <= ctx->segment_size, "next_segment_primes: range > segment size"); |
495
|
4697 |
0 |
if (ctx->warray != 0) |
509
|
0 |
4485 |
MPUassert(ctx != 0, "end_segment_primes given a null pointer"); |
510
|
4485 |
0 |
if (ctx->segment != 0) { |
514
|
0 |
4485 |
if (ctx->base != 0) { |
518
|
4485 |
0 |
if (ctx->warray != 0) { |
529
|
0 |
12 |
New(0, P, cntest, UV); |
530
|
0 |
12 |
if (beg <= 2 && end >= 2) P[i++] = 2; |
|
0 |
0 |
if (beg <= 2 && end >= 2) P[i++] = 2; |
531
|
0 |
12 |
if (beg <= 3 && end >= 3) P[i++] = 3; |
|
0 |
0 |
if (beg <= 3 && end >= 3) P[i++] = 3; |
532
|
0 |
12 |
if (beg <= 5 && end >= 5) P[i++] = 5; |
|
0 |
0 |
if (beg <= 5 && end >= 5) P[i++] = 5; |
537
|
188 |
12 |
while (next_segment_primes(ctx, &seg_base, &seg_low, &seg_high)) { |
538
|
10900246 |
0 |
START_DO_FOR_EACH_SIEVE_PRIME( segment, seg_base, seg_low, seg_high ) |
|
11 |
10900235 |
START_DO_FOR_EACH_SIEVE_PRIME( segment, seg_base, seg_low, seg_high ) |
|
10900219 |
16 |
START_DO_FOR_EACH_SIEVE_PRIME( segment, seg_base, seg_low, seg_high ) |
|
10900246 |
743595 |
START_DO_FOR_EACH_SIEVE_PRIME( segment, seg_base, seg_low, seg_high ) |
|
743606 |
188 |
START_DO_FOR_EACH_SIEVE_PRIME( segment, seg_base, seg_low, seg_high ) |