From c2dd6b491780610961cc213dba9f8d50446ceff3 Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Thu, 22 Sep 2016 15:22:28 +0200 Subject: [PATCH] encode.h: fix one-letter pre-processor symbol to avoid conflicts It was suggested to pick a more specific name for the pre-processor symbol E in encode.h to prevent name clashes, see https://github.com/obgm/libcoap/issues/46. --- include/coap/encode.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/coap/encode.h b/include/coap/encode.h index 283343d0..a5d290c4 100644 --- a/include/coap/encode.h +++ b/include/coap/encode.h @@ -17,11 +17,11 @@ #endif #define Nn 8 /* duplicate definition of N if built on sky motes */ -#define E 4 +#define ENCODE_HEADER_SIZE 4 #define HIBIT (1 << (Nn - 1)) -#define EMASK ((1 << E) - 1) +#define EMASK ((1 << ENCODE_HEADER_SIZE) - 1) #define MMASK ((1 << Nn) - 1 - EMASK) -#define MAX_VALUE ( (1 << Nn) - (1 << E) ) * (1 << ((1 << E) - 1)) +#define MAX_VALUE ( (1 << Nn) - (1 << ENCODE_HEADER_SIZE) ) * (1 << ((1 << ENCODE_HEADER_SIZE) - 1)) #define COAP_PSEUDOFP_DECODE_8_4(r) (r < HIBIT ? r : (r & MMASK) << (r & EMASK)) @@ -34,7 +34,7 @@ extern int coap_fls(unsigned int i); /* ls and s must be integer variables */ #define COAP_PSEUDOFP_ENCODE_8_4_DOWN(v,ls) (v < HIBIT ? v : (ls = coap_fls(v) - Nn, (v >> ls) & MMASK) + ls) -#define COAP_PSEUDOFP_ENCODE_8_4_UP(v,ls,s) (v < HIBIT ? v : (ls = coap_fls(v) - Nn, (s = (((v + ((1<> ls) & MMASK)), s == 0 ? HIBIT + ls + 1 : s + ls)) +#define COAP_PSEUDOFP_ENCODE_8_4_UP(v,ls,s) (v < HIBIT ? v : (ls = coap_fls(v) - Nn, (s = (((v + ((1<> ls) & MMASK)), s == 0 ? HIBIT + ls + 1 : s + ls)) /** * Decodes multiple-length byte sequences. buf points to an input byte sequence