aboutsummaryrefslogtreecommitdiff
path: root/src/util/numeric.h
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2014-10-29 01:54:11 -0400
committerkwolekr <kwolekr@minetest.net>2014-10-29 01:56:37 -0400
commit1cb6ea6346f568cd068380c5af52f7be269e3490 (patch)
tree1eab8e93b1621b5065c16c0973efecd4d5770939 /src/util/numeric.h
parent7c6da2f38468b1eaf3b6c9b5cd0ee985e6675e31 (diff)
downloadminetest-1cb6ea6346f568cd068380c5af52f7be269e3490.tar.gz
minetest-1cb6ea6346f568cd068380c5af52f7be269e3490.tar.bz2
minetest-1cb6ea6346f568cd068380c5af52f7be269e3490.zip
Refactor decoration-related code
Split up ModApiMapgen::l_register_decoration() Define and make use of CONTAINS() and ARRLEN() macros
Diffstat (limited to 'src/util/numeric.h')
-rw-r--r--src/util/numeric.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/util/numeric.h b/src/util/numeric.h
index 8e3a617ff..ee8fea8cf 100644
--- a/src/util/numeric.h
+++ b/src/util/numeric.h
@@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "../irr_v3d.h"
#include "../irr_aabb3d.h"
#include <list>
+#include <algorithm>
// Calculate the borders of a "d-radius" cube
void getFacePositions(std::list<v3s16> &list, u16 d);
@@ -139,6 +140,9 @@ inline v3s16 arealim(v3s16 p, s16 d)
return p;
}
+#define ARRLEN(x) (sizeof(x) / sizeof((x)[0]))
+#define CONTAINS(c, v) (std::find((c).begin(), (c).end(), (v)) != (c).end())
+
// The naive swap performs better than the xor version
#define SWAP(t, x, y) do { \
t temp = x; \