Skip to content

Commit

Permalink
Get rid of using std::min
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwalisch committed Jul 1, 2024
1 parent ddd07c4 commit eb3f1f5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
7 changes: 3 additions & 4 deletions src/lmo/pi_lmo3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,23 @@
/// pi(x) = pi(y) + S1(x, a) + S2(x, a) - 1 - P2(x, a)
/// with y = x^(1/3), a = pi(y)
///
/// Copyright (C) 2023 Kim Walisch, <kim.walisch@gmail.com>
/// Copyright (C) 2024 Kim Walisch, <kim.walisch@gmail.com>
///
/// This file is distributed under the BSD License. See the COPYING
/// file in the top level directory.
///

#include <primecount-internal.hpp>
#include <imath.hpp>
#include <generate.hpp>
#include <imath.hpp>
#include <min.hpp>
#include <Vector.hpp>
#include <PhiTiny.hpp>
#include <S.hpp>

#include <stdint.h>
#include <algorithm>

using std::min;
using std::max;
using namespace primecount;

namespace {
Expand Down
7 changes: 3 additions & 4 deletions src/lmo/pi_lmo4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
/// pi(x) = pi(y) + S1(x, a) + S2(x, a) - 1 - P2(x, a)
/// with y = x^(1/3), a = pi(y)
///
/// Copyright (C) 2023 Kim Walisch, <kim.walisch@gmail.com>
/// Copyright (C) 2024 Kim Walisch, <kim.walisch@gmail.com>
///
/// This file is distributed under the BSD License. See the COPYING
/// file in the top level directory.
///

#include <primecount-internal.hpp>
#include <imath.hpp>
#include <generate.hpp>
#include <imath.hpp>
#include <min.hpp>
#include <PhiTiny.hpp>
#include <Vector.hpp>
#include <BinaryIndexedTree.hpp>
Expand All @@ -28,8 +29,6 @@
#include <stdint.h>
#include <algorithm>

using std::min;
using std::max;
using namespace primecount;

namespace {
Expand Down
6 changes: 2 additions & 4 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <int128_t.hpp>
#include <imath.hpp>
#include <macros.hpp>
#include <min.hpp>

#include <algorithm>
#include <chrono>
Expand All @@ -23,9 +24,6 @@
#include <stdint.h>
#include <utility>

using std::min;
using std::max;

namespace {

int status_precision_ = -1;
Expand Down Expand Up @@ -432,7 +430,7 @@ int64_t get_x_star_gourdon(maxint_t x, int64_t y)
// numbers below 10^6.
x_star = min(x_star, y);
x_star = min(x_star, sqrt_xy);
x_star = max(x_star, (int64_t) 1);
x_star = max(x_star, 1);

return x_star;
}
Expand Down
5 changes: 2 additions & 3 deletions test/deleglise-rivat/S2_easy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// S2_easy(x, y) used in the Lagarias-Miller-Odlyzko
/// and Deleglise-Rivat prime counting algorithms.
///
/// Copyright (C) 2023 Kim Walisch, <kim.walisch@gmail.com>
/// Copyright (C) 2024 Kim Walisch, <kim.walisch@gmail.com>
///
/// This file is distributed under the BSD License. See the COPYING
/// file in the top level directory.
Expand All @@ -16,6 +16,7 @@
#include <PiTable.hpp>
#include <generate.hpp>
#include <imath.hpp>
#include <min.hpp>
#include <S.hpp>

#include <stdint.h>
Expand All @@ -25,8 +26,6 @@
#include <vector>
#include <random>

using std::min;
using std::max;
using namespace primecount;

void check(bool OK)
Expand Down

0 comments on commit eb3f1f5

Please sign in to comment.