sys: util: Extend IS_EQ to support unsigned literals
Extend IS_EQ to include unsigned integer literals like 0U. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
0f267e4878
commit
78ba5cd61a
3 changed files with 16402 additions and 4099 deletions
|
@ -50,7 +50,7 @@
|
|||
#define Z_IS_ENABLED3(ignore_this, val, ...) val
|
||||
|
||||
/* Implementation of IS_EQ(). Returns 1 if _0 and _1 are the same integer from
|
||||
* 0 to 4095, 0 otherwise.
|
||||
* 0 to 4096, 0 otherwise.
|
||||
*/
|
||||
#define Z_IS_EQ(_0, _1) Z_HAS_COMMA(Z_CAT4(Z_IS_, _0, _EQ_, _1)())
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -296,7 +296,19 @@ extern "C" {
|
|||
* @brief Like <tt>a == b</tt>, but does evaluation and
|
||||
* short-circuiting at C preprocessor time.
|
||||
*
|
||||
* This however only works for integer literal from 0 to 4095.
|
||||
* This however only works for integer literal from 0 to 4096 (literals with U suffix,
|
||||
* e.g. 0U are also included).
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* IS_EQ(1, 1) -> 1
|
||||
* IS_EQ(1U, 1U) -> 1
|
||||
* IS_EQ(1U, 1) -> 1
|
||||
* IS_EQ(1, 1U) -> 1
|
||||
* IS_EQ(1, 0) -> 0
|
||||
*
|
||||
* @param a Integer literal (can be with U suffix)
|
||||
* @param b Integer literal
|
||||
*
|
||||
*/
|
||||
#define IS_EQ(a, b) Z_IS_EQ(a, b)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue