Branch Coverage

prime_sums.c
Criterion Covered Total %
branch 97 116 83.6


line true false branch
48 19 0 if (n < 2 || (n >> (BITS_PER_WORD/2)) > 0) /* S[] will overflow */
7 12 if (n < 2 || (n >> (BITS_PER_WORD/2)) > 0) /* S[] will overflow */
55 444188 12 for (k = 1; k <= r2; k++) {
56 222096 222092 UV v = (k <= r) ? k : n/(r2-k+1);
61 222084 12 for (p = 2; p <= r; p++) {
62 23284 198800 if (S[p] > S[p-1]) { /* For each prime p from 2 to r */
64 25830282 0 for (j = r2; j > 1 && V[j] >= p2; j--) {
25806998 23284 for (j = r2; j > 1 && V[j] >= p2; j--) {
66 18188400 7618598 if (a > r) a = r2 - n/a + 1;
67 573719 25233279 if (b > r) b = r2 - n/b + 1;
91 0 1 New(0, V, r2+1, UV);
92 0 1 New(0, S, r2+1, uint128_t);
93 343542 1 for (k = 0; k <= r2; k++) {
94 171770 171772 UV v = (k <= r) ? k : n/(r2-k+1);
99 171770 1 for (p = 2; p <= r; p++) {
100 15648 156122 if (S[p] > S[p-1]) { /* For each prime p from 2 to r */
102 33779919 0 for (j = r2; j > 1 && V[j] >= p2; j--) {
33764271 15648 for (j = r2; j > 1 && V[j] >= p2; j--) {
104 23930354 9833917 if (a > r) a = r2 - n/a + 1;
105 465826 33298445 if (b > r) b = r2 - n/b + 1;
159 1026 4 if (low <= 2 && high >= 100000) {
19 1007 if (low <= 2 && high >= 100000) {
161 12 7 if (*return_sum != 0)
166 1014 4 if ((low <= 2) && (high >= 2)) sum += 2;
1012 2 if ((low <= 2) && (high >= 2)) sum += 2;
167 1014 4 if ((low <= 3) && (high >= 3)) sum += 3;
1011 3 if ((low <= 3) && (high >= 3)) sum += 3;
168 1014 4 if ((low <= 5) && (high >= 5)) sum += 5;
1009 5 if ((low <= 5) && (high >= 5)) sum += 5;
169 1014 4 if (low < 7) low = 7;
173 1014 4 if (low == 7 && high >= 29505444491) return 0;
1 1013 if (low == 7 && high >= 29505444491) return 0;
174 0 1017 if (low >= 1e10 && (high-low) >= 32e9) return 0;
0 0 if (low >= 1e10 && (high-low) >= 32e9) return 0;
175 0 1017 if (low >= 1e13 && (high-low) >= 5e7) return 0;
0 0 if (low >= 1e13 && (high-low) >= 5e7) return 0;
181 1013 4 if (low == 7 && high >= 2e8) {
6 1007 if (low == 7 && high >= 2e8) {
183 443 5 for (step = 1; high >= (step * 2e8) && step < N_SUM_TABLE; step++) {
442 1 for (step = 1; high >= (step * 2e8) && step < N_SUM_TABLE; step++) {
190 1010 7 if (low <= high) {
194 2245 0 while (!overflow && next_segment_primes(ctx, &seg_base, &seg_low, &seg_high)) {
1235 1010 while (!overflow && next_segment_primes(ctx, &seg_base, &seg_low, &seg_high)) {
203 2271 0 for (i = 0; i < 8 && p+wheel30[i] < low; i++)
1036 1235 for (i = 0; i < 8 && p+wheel30[i] < low; i++)
204 5 1031 if ( (*sp & (1<
208 9880 1235 for (i = 0; i < 8; i++)
209 5242 4638 if ( (*spend & (1< high )
2480 2762 if ( (*spend & (1< high )
212 20388785 1235 while (sp <= spend) {
214 3192482 17196303 if (sum < (UV_MAX >> 3) && pbase < (UV_MAX >> 5)) {
3192482 0 if (sum < (UV_MAX >> 3) && pbase < (UV_MAX >> 5)) {
219 21544883 17196303 for (i = 0; i < byte_zeros[s]; i++) {
220 0 21544883 if (sum+pbase < sum) overflow = 1;
223 0 17196303 if (sum+byte_sum[s] < sum) overflow = 1;
225 0 17196303 if (overflow) break;
232 1017 0 if (!overflow && return_sum != 0) *return_sum = sum;
1017 0 if (!overflow && return_sum != 0) *return_sum = sum;