summaryrefslogtreecommitdiff
path: root/src/basicmacros.h
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-10-27 01:50:46 -0400
committerkwolekr <kwolekr@minetest.net>2015-10-27 01:53:45 -0400
commit27eed1389b8bece41950c53b47acffb3bb0c83ee (patch)
treecada2292121b26707b6155fc0ae3ddabc82437cb /src/basicmacros.h
parent8a6e921cb8c9886db598dd77ddde3e7ba294085a (diff)
downloadminetest-27eed1389b8bece41950c53b47acffb3bb0c83ee.tar.gz
minetest-27eed1389b8bece41950c53b47acffb3bb0c83ee.tar.bz2
minetest-27eed1389b8bece41950c53b47acffb3bb0c83ee.zip
Move basic, non-numeric macros from util/numeric.h to basicmacros.h
Diffstat (limited to 'src/basicmacros.h')
-rw-r--r--src/basicmacros.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/basicmacros.h b/src/basicmacros.h
new file mode 100644
index 000000000..2b183d6c5
--- /dev/null
+++ b/src/basicmacros.h
@@ -0,0 +1,31 @@
+/*
+Minetest
+Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#ifndef BASICMACROS_HEADER
+#define BASICMACROS_HEADER
+
+#define ARRLEN(x) (sizeof(x) / sizeof((x)[0]))
+
+#define MYMIN(a, b) ((a) < (b) ? (a) : (b))
+
+#define MYMAX(a, b) ((a) > (b) ? (a) : (b))
+
+#define CONTAINS(c, v) (std::find((c).begin(), (c).end(), (v)) != (c).end())
+
+#endif