Skip to content

Commit

Permalink
Remove MIN and MAX macros
Browse files Browse the repository at this point in the history
  • Loading branch information
torognes committed Mar 1, 2021
1 parent 259169b commit 0420591
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/algo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ void algo_run(struct Parameters const & p)
(xmalloc(amplicons * sizeof(uint64_t)));

auto diff_saturation
= static_cast<uint64_t>(MIN(UINT8_MAX / penalty_mismatch,
UINT8_MAX / (penalty_gapopen +
penalty_gapextend)));
= static_cast<uint64_t>(std::min(UINT8_MAX / penalty_mismatch,
UINT8_MAX / (penalty_gapopen +
penalty_gapextend)));

unsigned char * dir {nullptr};
uint64_t * hearray {nullptr};
Expand Down
2 changes: 1 addition & 1 deletion src/bloompat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ auto bloom_init(uint64_t size) -> struct bloom_s *
{
// Size is in bytes for full bitmap, must be power of 2
// at least 8
size = MAX(size, 8);
size = std::max(size, static_cast<uint64_t>(8));

auto * b = static_cast<struct bloom_s *>(xmalloc(sizeof(struct bloom_s)));

Expand Down
8 changes: 4 additions & 4 deletions src/nw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ void nw(char * dseq,
+(nt_extract(qseq, static_cast<uint64_t>(i)) + 1)];

dir[index] |= (f < h ? maskup : 0);
h = MIN(h, f);
h = MIN(h, e);
h = std::min(h, f);
h = std::min(h, e);
dir[index] |= (e == h ? maskleft : 0);

*hep = h;
Expand All @@ -177,8 +177,8 @@ void nw(char * dseq,

dir[index] |= (f < h ? maskextup : 0);
dir[index] |= (e < h ? maskextleft : 0);
f = MIN(h,f);
e = MIN(h,e);
f = std::min(h,f);
e = std::min(h,e);

*(hep+1) = e;
h = n;
Expand Down
6 changes: 3 additions & 3 deletions src/swarm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -787,9 +787,9 @@ auto main(int argc, char** argv) -> int
penalty_gapopen /= penalty_factor;
penalty_gapextend /= penalty_factor;

int64_t diff_saturation_16 = (MIN((UINT16_MAX / penalty_mismatch),
(UINT16_MAX - penalty_gapopen)
/ penalty_gapextend));
int64_t diff_saturation_16 = (std::min((UINT16_MAX / penalty_mismatch),
(UINT16_MAX - penalty_gapopen)
/ penalty_gapextend));

if (p.opt_differences > diff_saturation_16)
fatal("Resolution (d) too high for the given scoring system");
Expand Down
12 changes: 1 addition & 11 deletions src/swarm.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ constexpr char PRId64[] = "ld";
#endif
#endif

#include <algorithm>
#include <array>
#include <cassert>
#include <climits>
Expand Down Expand Up @@ -108,19 +109,8 @@ static_assert(INT_MAX > INT16_MAX, "Your compiler uses very short integers.");
/* constants */

const std::string swarm_version = {"Swarm 3.0.0"};
// constexpr unsigned int width {32}; // unused?
// constexpr unsigned int width_shift {5}; // unused?
constexpr char sepchar {' '};
constexpr unsigned int bloom_bits_default {16};

#ifndef MIN
#define MIN(x,y) ((x)<(y)?(x):(y))
#endif

#ifndef MAX
#define MAX(x,y) ((x)>(y)?(x):(y))
#endif

constexpr unsigned int qgramlength {5};
constexpr unsigned int qgramvectorbits {1 << (2 * qgramlength)};
constexpr unsigned int qgramvectorbytes {qgramvectorbits / 8};
Expand Down

0 comments on commit 0420591

Please sign in to comment.