incorporate code review comment in embedded_test.function

This commit is contained in:
Azim Khan 2017-07-07 16:17:27 +01:00 committed by Mohammad Azim Khan
parent 663d4702c5
commit d61a4384d8

View File

@ -13,12 +13,12 @@
*/ */
#define INCR_ASSERT(p, start, len, step) do \ #define INCR_ASSERT(p, start, len, step) do \
{ \ { \
assert( p >= start ); \ assert( ( p ) >= ( start ) ); \
assert( sizeof( *p ) == sizeof( *start ) ); \ assert( sizeof( *( p ) ) == sizeof( *( start ) ) ); \
/* <= is checked to support use inside a loop where \ /* <= is checked to support use inside a loop where \
pointer is incremented after reading data. */ \ pointer is incremented after reading data. */ \
assert( (uint32_t)( (p - start) + step ) <= len ); \ assert( (uint32_t)( ( ( p ) - ( start ) ) + step ) <= len );\
p += step; \ ( p ) += step; \
} \ } \
while( 0 ) while( 0 )
@ -33,7 +33,7 @@ while( 0 )
*/ */
#define ALIGN_32BIT(p, start, len) do \ #define ALIGN_32BIT(p, start, len) do \
{ \ { \
uint32_t align = ( - (uintptr_t)p ) % 4; \ uint32_t align = ( - (uintptr_t)( p ) ) % 4;\
INCR_ASSERT(p, start, len, align); \ INCR_ASSERT(p, start, len, align); \
} \ } \
while( 0 ) while( 0 )