Skip to content

Commit 0420591

Browse files
committed
Remove MIN and MAX macros
1 parent 259169b commit 0420591

File tree

5 files changed

+12
-22
lines changed

5 files changed

+12
-22
lines changed

src/algo.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ void algo_run(struct Parameters const & p)
126126
(xmalloc(amplicons * sizeof(uint64_t)));
127127

128128
auto diff_saturation
129-
= static_cast<uint64_t>(MIN(UINT8_MAX / penalty_mismatch,
130-
UINT8_MAX / (penalty_gapopen +
131-
penalty_gapextend)));
129+
= static_cast<uint64_t>(std::min(UINT8_MAX / penalty_mismatch,
130+
UINT8_MAX / (penalty_gapopen +
131+
penalty_gapextend)));
132132

133133
unsigned char * dir {nullptr};
134134
uint64_t * hearray {nullptr};

src/bloompat.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ auto bloom_init(uint64_t size) -> struct bloom_s *
6464
{
6565
// Size is in bytes for full bitmap, must be power of 2
6666
// at least 8
67-
size = MAX(size, 8);
67+
size = std::max(size, static_cast<uint64_t>(8));
6868

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

src/nw.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ void nw(char * dseq,
165165
+(nt_extract(qseq, static_cast<uint64_t>(i)) + 1)];
166166

167167
dir[index] |= (f < h ? maskup : 0);
168-
h = MIN(h, f);
169-
h = MIN(h, e);
168+
h = std::min(h, f);
169+
h = std::min(h, e);
170170
dir[index] |= (e == h ? maskleft : 0);
171171

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

178178
dir[index] |= (f < h ? maskextup : 0);
179179
dir[index] |= (e < h ? maskextleft : 0);
180-
f = MIN(h,f);
181-
e = MIN(h,e);
180+
f = std::min(h,f);
181+
e = std::min(h,e);
182182

183183
*(hep+1) = e;
184184
h = n;

src/swarm.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -787,9 +787,9 @@ auto main(int argc, char** argv) -> int
787787
penalty_gapopen /= penalty_factor;
788788
penalty_gapextend /= penalty_factor;
789789

790-
int64_t diff_saturation_16 = (MIN((UINT16_MAX / penalty_mismatch),
791-
(UINT16_MAX - penalty_gapopen)
792-
/ penalty_gapextend));
790+
int64_t diff_saturation_16 = (std::min((UINT16_MAX / penalty_mismatch),
791+
(UINT16_MAX - penalty_gapopen)
792+
/ penalty_gapextend));
793793

794794
if (p.opt_differences > diff_saturation_16)
795795
fatal("Resolution (d) too high for the given scoring system");

src/swarm.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ constexpr char PRId64[] = "ld";
3939
#endif
4040
#endif
4141

42+
#include <algorithm>
4243
#include <array>
4344
#include <cassert>
4445
#include <climits>
@@ -108,19 +109,8 @@ static_assert(INT_MAX > INT16_MAX, "Your compiler uses very short integers.");
108109
/* constants */
109110

110111
const std::string swarm_version = {"Swarm 3.0.0"};
111-
// constexpr unsigned int width {32}; // unused?
112-
// constexpr unsigned int width_shift {5}; // unused?
113112
constexpr char sepchar {' '};
114113
constexpr unsigned int bloom_bits_default {16};
115-
116-
#ifndef MIN
117-
#define MIN(x,y) ((x)<(y)?(x):(y))
118-
#endif
119-
120-
#ifndef MAX
121-
#define MAX(x,y) ((x)>(y)?(x):(y))
122-
#endif
123-
124114
constexpr unsigned int qgramlength {5};
125115
constexpr unsigned int qgramvectorbits {1 << (2 * qgramlength)};
126116
constexpr unsigned int qgramvectorbytes {qgramvectorbits / 8};

0 commit comments

Comments
 (0)