From 6e006d216b092d9d14d0145ae94b908f562205ee Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sun, 7 Feb 2021 00:25:47 +0100 Subject: [PATCH] Add macro M_GREATER_OR_EQUAL_P (src, test, doc) --- README.md | 5 +++++ m-core.h | 4 ++++ tests/test-mcore.c | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/README.md b/README.md index b6f955ce..acde79f3 100644 --- a/README.md +++ b/README.md @@ -5451,6 +5451,11 @@ x and y shall be within [0..M\_MAX\_NB\_ARGUMENT]. Return 1 if x < y, 0 otherwise (resolution is performed at preprocessing time). x and y shall be within [0..M\_MAX\_NB\_ARGUMENT].x +##### M\_GREATER_OR\_EQUAL\_P(x, y) + +Return 1 if x >= y, 0 otherwise (resolution is performed at preprocessing time). +x and y shall be within [0..M\_MAX\_NB\_ARGUMENT].x + ##### M\_COMMA\_P(arglist) Return 1 if there is a comma inside the argument list, 0 otherwise. diff --git a/m-core.h b/m-core.h index f97700bf..1991610a 100644 --- a/m-core.h +++ b/m-core.h @@ -1741,6 +1741,10 @@ M_BEGIN_PROTECTED_CODE a and b shall be in [0..M_MAX_NB_ARGUMENT] */ #define M_LESS_THAN_P(a, b) M_KEYWORD_P(UNDERFLOW, M_SUB(a, b)) +/* Return 1 if a >= b, 0 otherwise + a and b shall be in [0..M_MAX_NB_ARGUMENT] */ +#define M_GREATER_OR_EQUAL_P(a, b) M_INV(M_LESS_THAN_P(a, b)) + /* Revert the list given as parameter Example: M_REVERSE(a,b,c) --> (c,b,a) */ /* Generated by: diff --git a/tests/test-mcore.c b/tests/test-mcore.c index 13847307..c4e3d520 100644 --- a/tests/test-mcore.c +++ b/tests/test-mcore.c @@ -128,6 +128,13 @@ static void test_incdec(void) assert(M_LESS_THAN_P(4, 6)); assert(M_LESS_THAN_P(4, 7)); + assert(M_GREATER_OR_EQUAL_P(4, 2)); + assert(M_GREATER_OR_EQUAL_P(4, 3)); + assert(M_GREATER_OR_EQUAL_P(4, 4)); + assert(!M_GREATER_OR_EQUAL_P(4, 5)); + assert(!M_GREATER_OR_EQUAL_P(4, 6)); + assert(!M_GREATER_OR_EQUAL_P(4, 7)); + assert(!M_KEYWORD_P(UNDERFLOW, M_SUB(1, 1))); assert(M_KEYWORD_P(UNDERFLOW, M_SUB(1, 2))); assert(M_KEYWORD_P(UNDERFLOW, M_SUB(1, 6)));