X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=cfg%2Fmacros.h;h=ded2261bd9d64de06631508109a5e8bd293a30bc;hb=ff16c7e3fd2184d58a87d5fe1576cd246ecb719e;hp=d33ee401ef5cc0010e528363d34d952e92b597d6;hpb=8c8d2df610762e52e41e7d6f94f0d1c185841ae8;p=bertos.git diff --git a/cfg/macros.h b/cfg/macros.h index d33ee401..ded2261b 100755 --- a/cfg/macros.h +++ b/cfg/macros.h @@ -2,7 +2,7 @@ * \file * * * \brief Common and handy function macros @@ -14,6 +14,15 @@ /*#* *#* $Log$ + *#* Revision 1.6 2006/02/10 12:36:57 bernie + *#* Pacify IAR warnings for side-effects. + *#* + *#* Revision 1.5 2005/11/04 16:20:01 bernie + *#* Fix reference to README.devlib in header. + *#* + *#* Revision 1.4 2005/07/03 15:19:09 bernie + *#* Doxygen fix. + *#* *#* Revision 1.3 2005/06/27 21:23:32 bernie *#* ROUND_DOWN, ROUND_UP, ROUND_NEAREST: New macros. *#* @@ -131,7 +140,13 @@ } while (0) #else /* !COMPILER_TYPEOF */ /* Sub-optimal implementation that only works with integral types. */ - #define SWAP(a, b) ((a) ^= (b) ^= (a) ^= (b)) + #define SWAP(a, b) \ + do { \ + (a) ^= (b); \ + (b) ^= (a); \ + (a) ^= (b); \ + } while (0) + #endif /* COMPILER_TYPEOF */ #ifndef BV @@ -143,7 +158,8 @@ #define ROUND2(x, pad) (((x) + ((pad) - 1)) & ~((pad) - 1)) /*! - * Integer round macros. + * \name Integer round macros. + * * Round \a x to a multiple of \a base. * \note If \a x is signed these macros generate a lot of code. * \{