From f97d80a10cbef9fe07651e831bc72ca350833775 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Thu, 27 Sep 2007 12:08:12 +0000 Subject: [PATCH] Add the famous ENDOF() macro which calculates the address of the one past last element of an array whose size is known statically. [r15942] --- ir/common/irtools.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ir/common/irtools.h b/ir/common/irtools.h index 2367fc56b..a5d7f2697 100644 --- a/ir/common/irtools.h +++ b/ir/common/irtools.h @@ -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. -- 2.20.1