Lines Matching +full:- +full:i
1 //===-------------------------- hash.cpp ----------------------------------===//
8 //===----------------------------------------------------------------------===//
16 #pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare"
23 // handle all next_prime(i) for i in [1, 210), special case 0
76 // potential primes = 210*k + indices[i], k >= 1
136 // The algorithm creates a list of small primes, plus an open-ended list of
184 if (n <= small_primes[N-1]) in __next_prime()
192 // Known a-priori n >= L in __next_prime()
194 size_t in = static_cast<size_t>(std::lower_bound(indices, indices + M, n - k0 * L) in __next_prime()
195 - indices); in __next_prime()
199 // Divide n by all primes or potential primes (i) until: in __next_prime()
201 // 2. The i > sqrt(n), in which case n is prime. in __next_prime()
202 // It is known a-priori that n is not divisible by 2, 3, 5 or 7, in __next_prime()
203 // so don't test those (j == 5 -> divide by 11 first). And the in __next_prime()
206 for (size_t j = 5; j < N - 1; ++j) in __next_prime()
217 size_t i = 211; in __next_prime() local
220 std::size_t q = n / i; in __next_prime()
221 if (q < i) in __next_prime()
223 if (n == q * i) in __next_prime()
226 i += 10; in __next_prime()
227 q = n / i; in __next_prime()
228 if (q < i) in __next_prime()
230 if (n == q * i) in __next_prime()
233 i += 2; in __next_prime()
234 q = n / i; in __next_prime()
235 if (q < i) in __next_prime()
237 if (n == q * i) in __next_prime()
240 i += 4; in __next_prime()
241 q = n / i; in __next_prime()
242 if (q < i) in __next_prime()
244 if (n == q * i) in __next_prime()
247 i += 2; in __next_prime()
248 q = n / i; in __next_prime()
249 if (q < i) in __next_prime()
251 if (n == q * i) in __next_prime()
254 i += 4; in __next_prime()
255 q = n / i; in __next_prime()
256 if (q < i) in __next_prime()
258 if (n == q * i) in __next_prime()
261 i += 6; in __next_prime()
262 q = n / i; in __next_prime()
263 if (q < i) in __next_prime()
265 if (n == q * i) in __next_prime()
268 i += 2; in __next_prime()
269 q = n / i; in __next_prime()
270 if (q < i) in __next_prime()
272 if (n == q * i) in __next_prime()
275 i += 6; in __next_prime()
276 q = n / i; in __next_prime()
277 if (q < i) in __next_prime()
279 if (n == q * i) in __next_prime()
282 i += 4; in __next_prime()
283 q = n / i; in __next_prime()
284 if (q < i) in __next_prime()
286 if (n == q * i) in __next_prime()
289 i += 2; in __next_prime()
290 q = n / i; in __next_prime()
291 if (q < i) in __next_prime()
293 if (n == q * i) in __next_prime()
296 i += 4; in __next_prime()
297 q = n / i; in __next_prime()
298 if (q < i) in __next_prime()
300 if (n == q * i) in __next_prime()
303 i += 6; in __next_prime()
304 q = n / i; in __next_prime()
305 if (q < i) in __next_prime()
307 if (n == q * i) in __next_prime()
310 i += 6; in __next_prime()
311 q = n / i; in __next_prime()
312 if (q < i) in __next_prime()
314 if (n == q * i) in __next_prime()
317 i += 2; in __next_prime()
318 q = n / i; in __next_prime()
319 if (q < i) in __next_prime()
321 if (n == q * i) in __next_prime()
324 i += 6; in __next_prime()
325 q = n / i; in __next_prime()
326 if (q < i) in __next_prime()
328 if (n == q * i) in __next_prime()
331 i += 4; in __next_prime()
332 q = n / i; in __next_prime()
333 if (q < i) in __next_prime()
335 if (n == q * i) in __next_prime()
338 i += 2; in __next_prime()
339 q = n / i; in __next_prime()
340 if (q < i) in __next_prime()
342 if (n == q * i) in __next_prime()
345 i += 6; in __next_prime()
346 q = n / i; in __next_prime()
347 if (q < i) in __next_prime()
349 if (n == q * i) in __next_prime()
352 i += 4; in __next_prime()
353 q = n / i; in __next_prime()
354 if (q < i) in __next_prime()
356 if (n == q * i) in __next_prime()
359 i += 6; in __next_prime()
360 q = n / i; in __next_prime()
361 if (q < i) in __next_prime()
363 if (n == q * i) in __next_prime()
366 i += 8; in __next_prime()
367 q = n / i; in __next_prime()
368 if (q < i) in __next_prime()
370 if (n == q * i) in __next_prime()
373 i += 4; in __next_prime()
374 q = n / i; in __next_prime()
375 if (q < i) in __next_prime()
377 if (n == q * i) in __next_prime()
380 i += 2; in __next_prime()
381 q = n / i; in __next_prime()
382 if (q < i) in __next_prime()
384 if (n == q * i) in __next_prime()
387 i += 4; in __next_prime()
388 q = n / i; in __next_prime()
389 if (q < i) in __next_prime()
391 if (n == q * i) in __next_prime()
394 i += 2; in __next_prime()
395 q = n / i; in __next_prime()
396 if (q < i) in __next_prime()
398 if (n == q * i) in __next_prime()
401 i += 4; in __next_prime()
402 q = n / i; in __next_prime()
403 if (q < i) in __next_prime()
405 if (n == q * i) in __next_prime()
408 i += 8; in __next_prime()
409 q = n / i; in __next_prime()
410 if (q < i) in __next_prime()
412 if (n == q * i) in __next_prime()
415 i += 6; in __next_prime()
416 q = n / i; in __next_prime()
417 if (q < i) in __next_prime()
419 if (n == q * i) in __next_prime()
422 i += 4; in __next_prime()
423 q = n / i; in __next_prime()
424 if (q < i) in __next_prime()
426 if (n == q * i) in __next_prime()
429 i += 6; in __next_prime()
430 q = n / i; in __next_prime()
431 if (q < i) in __next_prime()
433 if (n == q * i) in __next_prime()
436 i += 2; in __next_prime()
437 q = n / i; in __next_prime()
438 if (q < i) in __next_prime()
440 if (n == q * i) in __next_prime()
443 i += 4; in __next_prime()
444 q = n / i; in __next_prime()
445 if (q < i) in __next_prime()
447 if (n == q * i) in __next_prime()
450 i += 6; in __next_prime()
451 q = n / i; in __next_prime()
452 if (q < i) in __next_prime()
454 if (n == q * i) in __next_prime()
457 i += 2; in __next_prime()
458 q = n / i; in __next_prime()
459 if (q < i) in __next_prime()
461 if (n == q * i) in __next_prime()
464 i += 6; in __next_prime()
465 q = n / i; in __next_prime()
466 if (q < i) in __next_prime()
468 if (n == q * i) in __next_prime()
471 i += 6; in __next_prime()
472 q = n / i; in __next_prime()
473 if (q < i) in __next_prime()
475 if (n == q * i) in __next_prime()
478 i += 4; in __next_prime()
479 q = n / i; in __next_prime()
480 if (q < i) in __next_prime()
482 if (n == q * i) in __next_prime()
485 i += 2; in __next_prime()
486 q = n / i; in __next_prime()
487 if (q < i) in __next_prime()
489 if (n == q * i) in __next_prime()
492 i += 4; in __next_prime()
493 q = n / i; in __next_prime()
494 if (q < i) in __next_prime()
496 if (n == q * i) in __next_prime()
499 i += 6; in __next_prime()
500 q = n / i; in __next_prime()
501 if (q < i) in __next_prime()
503 if (n == q * i) in __next_prime()
506 i += 2; in __next_prime()
507 q = n / i; in __next_prime()
508 if (q < i) in __next_prime()
510 if (n == q * i) in __next_prime()
513 i += 6; in __next_prime()
514 q = n / i; in __next_prime()
515 if (q < i) in __next_prime()
517 if (n == q * i) in __next_prime()
520 i += 4; in __next_prime()
521 q = n / i; in __next_prime()
522 if (q < i) in __next_prime()
524 if (n == q * i) in __next_prime()
527 i += 2; in __next_prime()
528 q = n / i; in __next_prime()
529 if (q < i) in __next_prime()
531 if (n == q * i) in __next_prime()
534 i += 4; in __next_prime()
535 q = n / i; in __next_prime()
536 if (q < i) in __next_prime()
538 if (n == q * i) in __next_prime()
541 i += 2; in __next_prime()
542 q = n / i; in __next_prime()
543 if (q < i) in __next_prime()
545 if (n == q * i) in __next_prime()
548 i += 10; in __next_prime()
549 q = n / i; in __next_prime()
550 if (q < i) in __next_prime()
552 if (n == q * i) in __next_prime()
555 // This will loop i to the next "plane" of potential primes in __next_prime()
556 i += 2; in __next_prime()