diff --git a/py/misc.h b/py/misc.h
index 52498c70bdfc277ffeaba7471fca1cfac3a0cdf6..f58a9f669c1baf1658caecb069ab990a1334215c 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)