#define __stringify(s) #s
+/**
+ * Compute the number of elements of a variable length array.
+ * <code>
+ * const char *strs[] = { "a", "b", "c" };
+ * unsigned num_strs = ARRAY_SIZE(strs);
+ * </code>
+ */
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
+
+
/**
* Cast a member of a structure out to the containing structure.
* @param ptr The pointer to the member.
(type *)( (char *)__mptr - offsetof(type,member) );})
+/**
+ * Rounds @c m up to the nearest multiple of @c n using division.
+ * @param m The value to round up to @c n.
+ * @param n Round @c m up to a multiple of this number.
+ * @returns The rounded integer value.
+ */
+#define DIV_ROUND_UP(m, n) (((m) + (n) - 1) / (n))
+
+
/* DANGER!!!! here be dragons!
*
* Leave these fn's as byte accesses because it is safe
#define SCNx32 "x"
#define PRIi32 "i"
#define PRIu32 "u"
+#define PRId8 PRId32
typedef CYG_ADDRWORD intptr_t;
typedef int64_t intmax_t;