Add the famous ENDOF() macro which calculates the address of the one past last elemen...
authorChristoph Mallon <christoph.mallon@gmx.de>
Thu, 27 Sep 2007 12:08:12 +0000 (12:08 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Thu, 27 Sep 2007 12:08:12 +0000 (12:08 +0000)
[r15942]

ir/common/irtools.h

index 2367fc5..a5d7f26 100644 (file)
@@ -41,6 +41,10 @@ lc_opt_entry_t *firm_opt_get_root(void);
 #define MAX(x, y) ((x) > (y) ? (x) : (y))
 #define MIN(x, y) ((x) < (y) ? (x) : (y))
 
+/* calculate the address of the one past last element of an array whose size is
+ * known statically */
+#define ENDOF(x) ((x) + sizeof(x) / sizeof(*(x)))
+
 /**
  * Three valued compare as demanded by e.g. qsort(3)
  * @param c A number.