summaryrefslogtreecommitdiff
path: root/py/misc.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-04-26 10:47:29 +0100
committerDamien George <damien.p.george@gmail.com>2014-04-26 10:47:29 +0100
commit6d3c5e4301df363055dc256e6692c610e4d0b918 (patch)
treea07a18ed1a13d50990cf0e43a2a3c919cb14240d /py/misc.h
parentd139c489bab6b58906868e3fc8383ea813a122d4 (diff)
Add ARRAY_SIZE macro, and use it where possible.
Diffstat (limited to 'py/misc.h')
-rw-r--r--py/misc.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/py/misc.h b/py/misc.h
index 002a97ffe..bf31f7535 100644
--- a/py/misc.h
+++ b/py/misc.h
@@ -52,6 +52,11 @@ int m_get_total_bytes_allocated(void);
int m_get_current_bytes_allocated(void);
int m_get_peak_bytes_allocated(void);
+/** array helpers ***********************************************/
+
+// get the number of elements in a fixed-size array
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+
/** unichar / UTF-8 *********************************************/
typedef int unichar; // TODO