Skip to content

Commit 27eed13

Browse files
committedOct 27, 2015
Move basic, non-numeric macros from util/numeric.h to basicmacros.h
1 parent 8a6e921 commit 27eed13

File tree

2 files changed

+32
-10
lines changed

2 files changed

+32
-10
lines changed
 

‎src/basicmacros.h

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
Minetest
3+
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4+
5+
This program is free software; you can redistribute it and/or modify
6+
it under the terms of the GNU Lesser General Public License as published by
7+
the Free Software Foundation; either version 2.1 of the License, or
8+
(at your option) any later version.
9+
10+
This program is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public License along
16+
with this program; if not, write to the Free Software Foundation, Inc.,
17+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*/
19+
20+
#ifndef BASICMACROS_HEADER
21+
#define BASICMACROS_HEADER
22+
23+
#define ARRLEN(x) (sizeof(x) / sizeof((x)[0]))
24+
25+
#define MYMIN(a, b) ((a) < (b) ? (a) : (b))
26+
27+
#define MYMAX(a, b) ((a) > (b) ? (a) : (b))
28+
29+
#define CONTAINS(c, v) (std::find((c).begin(), (c).end(), (v)) != (c).end())
Has conversations. Original line has conversations.
30+
31+
#endif

‎src/util/numeric.h

+1-10
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
2020
#ifndef UTIL_NUMERIC_HEADER
2121
#define UTIL_NUMERIC_HEADER
2222

23+
#include "../basicmacros.h"
2324
#include "../irrlichttypes.h"
2425
#include "../irr_v2d.h"
2526
#include "../irr_v3d.h"
@@ -28,7 +29,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
2829
#include <list>
2930
#include <map>
3031
#include <vector>
31-
#include <algorithm>
3232

3333

3434
/*
@@ -166,9 +166,6 @@ inline v3s16 arealim(v3s16 p, s16 d)
166166
return p;
167167
}
168168

169-
#define ARRLEN(x) (sizeof(x) / sizeof((x)[0]))
170-
#define CONTAINS(c, v) (std::find((c).begin(), (c).end(), (v)) != (c).end())
171-
172169
// The naive swap performs better than the xor version
173170
#define SWAP(t, x, y) do { \
174171
t temp = x; \
@@ -278,12 +275,6 @@ u64 murmur_hash_64_ua(const void *key, int len, unsigned int seed);
278275
bool isBlockInSight(v3s16 blockpos_b, v3f camera_pos, v3f camera_dir,
279276
f32 camera_fov, f32 range, f32 *distance_ptr=NULL);
280277

281-
/*
282-
Some helper stuff
283-
*/
284-
#define MYMIN(a,b) ((a)<(b)?(a):(b))
285-
#define MYMAX(a,b) ((a)>(b)?(a):(b))
286-
287278
/*
288279
Returns nearest 32-bit integer for given floating point number.
289280
<cmath> and <math.h> in VC++ don't provide round().

0 commit comments

Comments
 (0)
Please sign in to comment.