File: S.hpp

package info (click to toggle)
primecount 7.20%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,660 kB
  • sloc: cpp: 21,734; ansic: 121; sh: 99; makefile: 89
file content (67 lines) | stat: -rw-r--r-- 2,535 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
///
/// @file  S.hpp
/// @brief The S1 and S2 functions are part of the Deleglise-Rivat
///        prime counting algorithm.
///
/// Copyright (C) 2025 Kim Walisch, <kim.walisch@gmail.com>
///
/// This file is distributed under the BSD License. See the COPYING
/// file in the top level directory.
///

#ifndef S_HPP
#define S_HPP

#include <cpu_arch_macros.hpp>
#include <int128_t.hpp>
#include <print.hpp>

#include <stdint.h>

namespace primecount {

int64_t S1(int64_t x, int64_t y, int64_t c, int threads, bool print = is_print());
int64_t S2_trivial(int64_t x, int64_t y, int64_t z, int64_t c, int threads, bool print = is_print());
int64_t S2_easy(int64_t x, int64_t y, int64_t z, int64_t c, int threads, bool print = is_print());
int64_t S2_hard(int64_t x, int64_t y, int64_t z, int64_t c, int64_t s2_hard_approx, int threads, bool print = is_print());

#if defined(ENABLE_PORTABLE_POPCNT64) || \
    defined(ENABLE_AVX512_VPOPCNT) || \
    defined(ENABLE_ARM_SVE)
  int64_t S2_hard_default(int64_t x, int64_t y, int64_t z, int64_t c, int64_t s2_hard_approx, int threads, bool print);
#endif

#if defined(ENABLE_MULTIARCH_AVX512_VPOPCNT)
  int64_t S2_hard_multiarch_avx512(int64_t x, int64_t y, int64_t z, int64_t c, int64_t s2_hard_approx, int threads, bool print);
#endif

#if defined(ENABLE_MULTIARCH_ARM_SVE)
  int64_t S2_hard_multiarch_arm_sve(int64_t x, int64_t y, int64_t z, int64_t c, int64_t s2_hard_approx, int threads, bool print);
#endif

#ifdef HAVE_INT128_T

int128_t S1(int128_t x, int64_t y, int64_t c, int threads, bool print = is_print());
int128_t S2_trivial(int128_t x, int64_t y, int64_t z, int64_t c, int threads, bool print = is_print());
int128_t S2_easy(int128_t x, int64_t y, int64_t z, int64_t c, int threads, bool print = is_print());
int128_t S2_hard(int128_t x, int64_t y, int64_t z, int64_t c, int128_t s2_hard_approx, int threads, bool print = is_print());

#if defined(ENABLE_PORTABLE_POPCNT64) || \
    defined(ENABLE_AVX512_VPOPCNT) || \
    defined(ENABLE_ARM_SVE)
  int128_t S2_hard_default(int128_t x, int64_t y, int64_t z, int64_t c, int128_t s2_hard_approx, int threads, bool print);
#endif

#if defined(ENABLE_MULTIARCH_AVX512_VPOPCNT)
  int128_t S2_hard_multiarch_avx512(int128_t x, int64_t y, int64_t z, int64_t c, int128_t s2_hard_approx, int threads, bool print);
#endif

#if defined(ENABLE_MULTIARCH_ARM_SVE)
  int128_t S2_hard_multiarch_arm_sve(int128_t x, int64_t y, int64_t z, int64_t c, int128_t s2_hard_approx, int threads, bool print);
#endif

#endif

} // namespace

#endif