From 7ef723e1c217652d6b329faa6aa3120fbd91d24c Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Tue, 9 Jun 2015 14:02:04 +0200 Subject: Replace array size calculation with macro --- common.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'common.h') diff --git a/common.h b/common.h index 7b699ca..58a253e 100644 --- a/common.h +++ b/common.h @@ -67,6 +67,8 @@ extern volatile uint8_t wakeup; void shutdownError (); #define sign(x) ((x < 0) ? -1 : 1) +/* get an array’s size/length */ +#define length(x) (sizeof(x)/sizeof(*x)) #endif /* COMMON_H */ -- cgit v1.2.3