summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-02-05 00:44:55 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-02-05 01:40:40 +0200
commit6e6b888e31f9a4c245f621ccd91d3fce5ac88463 (patch)
treec094e79aded8db5308c45c3d385402f6b45c7d87 /py
parente0723497b3dbce94e6ce2a2dcd59af510f094fa4 (diff)
downloadmicropython-6e6b888e31f9a4c245f621ccd91d3fce5ac88463.tar.gz
micropython-6e6b888e31f9a4c245f621ccd91d3fce5ac88463.zip
Add generic MIN()/MAX() functions.
Diffstat (limited to 'py')
-rw-r--r--py/misc.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/py/misc.h b/py/misc.h
index 52498c70bd..f58a9f669c 100644
--- a/py/misc.h
+++ b/py/misc.h
@@ -10,6 +10,11 @@
typedef unsigned char byte;
typedef unsigned int uint;
+/** generic ops *************************************************/
+
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
+
/** memomry allocation ******************************************/
// TODO make a lazy m_renew that can increase by a smaller amount than requested (but by at least 1 more element)