From 26fc2fab877529a41b07e93f57c6c2a8016a72e4 Mon Sep 17 00:00:00 2001 From: Niclas Finne Date: Tue, 12 Feb 2013 16:06:04 +0100 Subject: [PATCH] Bug fix: changed the macro RPL_LOLLIPOP_INCREMENT to update the counter instead of returning the new value since this is how the macro is used today. --- core/net/rpl/rpl-private.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/net/rpl/rpl-private.h b/core/net/rpl/rpl-private.h index 9dfd91927..3b9031c33 100644 --- a/core/net/rpl/rpl-private.h +++ b/core/net/rpl/rpl-private.h @@ -211,10 +211,14 @@ #define RPL_LOLLIPOP_CIRCULAR_REGION 127 #define RPL_LOLLIPOP_SEQUENCE_WINDOWS 16 #define RPL_LOLLIPOP_INIT (RPL_LOLLIPOP_MAX_VALUE - RPL_LOLLIPOP_SEQUENCE_WINDOWS + 1) -#define RPL_LOLLIPOP_INCREMENT(counter) \ - ((counter) > RPL_LOLLIPOP_CIRCULAR_REGION ? \ - ++(counter) & RPL_LOLLIPOP_MAX_VALUE : \ - ++(counter) & RPL_LOLLIPOP_CIRCULAR_REGION) +#define RPL_LOLLIPOP_INCREMENT(counter) \ + do { \ + if((counter) > RPL_LOLLIPOP_CIRCULAR_REGION) { \ + (counter) = ((counter) + 1) & RPL_LOLLIPOP_MAX_VALUE; \ + } else { \ + (counter) = ((counter) + 1) & RPL_LOLLIPOP_CIRCULAR_REGION; \ + } \ + } while(0) #define RPL_LOLLIPOP_IS_INIT(counter) \ ((counter) > RPL_LOLLIPOP_CIRCULAR_REGION)