1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

core/compiler_hints: add may_be_zero()

This commit is contained in:
Benjamin Valentin 2023-05-23 17:38:05 +02:00
parent 4c27aff295
commit 0ee46e8d42

View File

@ -181,6 +181,19 @@ extern "C" {
#define assume(cond) assert(cond)
#endif
/**
* @brief Wrapper function to silence "comparison is always false due to limited
* range of data type" type of warning when the warning is caused by a
* preprocessor configuration value that may be zero.
*
* @param[in] n Variable that may be zero
* @return The same variable @p n
*/
static inline unsigned may_be_zero(unsigned n)
{
return n;
}
#ifdef __cplusplus
}
#endif