From 1cb6ea6346f568cd068380c5af52f7be269e3490 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Wed, 29 Oct 2014 01:54:11 -0400 Subject: Refactor decoration-related code Split up ModApiMapgen::l_register_decoration() Define and make use of CONTAINS() and ARRLEN() macros --- src/util/numeric.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/util/numeric.h') 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 +#include // Calculate the borders of a "d-radius" cube void getFacePositions(std::list &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; \ -- cgit v1.2.3