projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Doxygen fix.
[bertos.git]
/
cfg
/
macros.h
diff --git
a/cfg/macros.h
b/cfg/macros.h
index ded2261bd9d64de06631508109a5e8bd293a30bc..a017457e2d7e2bebbf8f67c0aac87cee395f693b 100755
(executable)
--- a/
cfg/macros.h
+++ b/
cfg/macros.h
@@
-14,6
+14,12
@@
/*#*
*#* $Log$
/*#*
*#* $Log$
+ *#* Revision 1.8 2006/03/13 02:06:55 bernie
+ *#* ROUND_UP2: Rename from ROUND2.
+ *#*
+ *#* Revision 1.7 2006/02/20 14:34:58 bernie
+ *#* Use portable type checking.
+ *#*
*#* Revision 1.6 2006/02/10 12:36:57 bernie
*#* Pacify IAR warnings for side-effects.
*#*
*#* Revision 1.6 2006/02/10 12:36:57 bernie
*#* Pacify IAR warnings for side-effects.
*#*
@@
-102,13
+108,13
@@
#define MIN(a,b) ({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
#define MIN(a,b) ({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
-
(void)(&_a == &_b); /* ensure same type */
\
+
ASSERT_TYPE_EQUAL(_a, _b);
\
(_a < _b) ? _a : _b; \
})
#define MAX(a,b) ({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
(_a < _b) ? _a : _b; \
})
#define MAX(a,b) ({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
-
(void)(&_a == &_b); /* ensure same type */
\
+
ASSERT_TYPE_EQUAL(_a, _b);
\
(_a > _b) ? _a : _b; \
})
#else /* !(COMPILER_STATEMENT_EXPRESSIONS && COMPILER_TYPEOF) */
(_a > _b) ? _a : _b; \
})
#else /* !(COMPILER_STATEMENT_EXPRESSIONS && COMPILER_TYPEOF) */
@@
-132,8
+138,8
@@
*/
#define SWAP(a, b) \
do { \
*/
#define SWAP(a, b) \
do { \
- (void)(&(a) == &(b)); /* type check */ \
typeof(a) tmp; \
typeof(a) tmp; \
+ ASSERT_TYPE_EQUAL(a, b); \
tmp = (a); \
(a) = (b); \
(b) = tmp; \
tmp = (a); \
(a) = (b); \
(b) = tmp; \
@@
-154,8
+160,11
@@
#define BV(x) (1<<(x))
#endif
#define BV(x) (1<<(x))
#endif
-/*! Round up \a x to an even multiple of the 2's power \a pad */
-#define ROUND2(x, pad) (((x) + ((pad) - 1)) & ~((pad) - 1))
+/** Round up \a x to an even multiple of the 2's power \a pad. */
+#define ROUND_UP2(x, pad) (((x) + ((pad) - 1)) & ~((pad) - 1))
+
+/* OBSOLETE */
+#define ROUND2 ROUND_UP2
/*!
* \name Integer round macros.
/*!
* \name Integer round macros.
@@
-169,7
+178,7
@@
#define ROUND_NEAREST(x, base) ( ((x) + (base) / 2) - (((x) + (base) / 2) % (base)) )
/* \} */
#define ROUND_NEAREST(x, base) ( ((x) + (base) / 2) - (((x) + (base) / 2) % (base)) )
/* \} */
-/
/! Check if \a x is an integer power of 2
+/
** Check if \a x is an integer power of 2. */
#define IS_POW2(x) (!(bool)((x) & ((x)-1)))
/*! Calculate a compile-time log2 for a uint8_t */
#define IS_POW2(x) (!(bool)((x) & ((x)-1)))
/*! Calculate a compile-time log2 for a uint8_t */