diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2023-08-06 16:54:57 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2023-08-06 16:54:57 (GMT) |
commit | 4fcc35a52ccb025b6d803d85e017931cd2452960 (patch) | |
tree | e95920f16c273e41f9cae1ea2f02571c221a514e /src/glibext | |
parent | 74d062d4ec55d7ac3914bbf64b8b6c5ab52227df (diff) |
Extend the ROST grammar with a first batch of new features.
Diffstat (limited to 'src/glibext')
-rw-r--r-- | src/glibext/comparison-int.h | 5 | ||||
-rw-r--r-- | src/glibext/comparison.c | 58 |
2 files changed, 61 insertions, 2 deletions
diff --git a/src/glibext/comparison-int.h b/src/glibext/comparison-int.h index efb289a..446f25d 100644 --- a/src/glibext/comparison-int.h +++ b/src/glibext/comparison-int.h @@ -48,7 +48,10 @@ typedef GComparableItemIface GComparableItemInterface; /* Réalise une comparaison riche entre valeurs entière. */ -bool compare_rich_integer_values(unsigned long long, unsigned long long, RichCmpOperation); +bool compare_rich_integer_values_signed(long long, long long, RichCmpOperation); + +/* Réalise une comparaison riche entre valeurs entière. */ +bool compare_rich_integer_values_unsigned(unsigned long long, unsigned long long, RichCmpOperation); diff --git a/src/glibext/comparison.c b/src/glibext/comparison.c index 463f354..8ce6941 100644 --- a/src/glibext/comparison.c +++ b/src/glibext/comparison.c @@ -101,7 +101,63 @@ bool g_comparable_item_compare_rich(const GComparableItem *item, const GComparab * * ******************************************************************************/ -bool compare_rich_integer_values(unsigned long long a, unsigned long long b, RichCmpOperation op) +bool compare_rich_integer_values_signed(long long a, long long b, RichCmpOperation op) +{ + bool result; /* Bilan à retourner */ + + switch (op) + { + case RCO_LT: + result = (a < b); + break; + + case RCO_LE: + result = (a <= b); + break; + + case RCO_EQ: + result = (a == b); + break; + + case RCO_NE: + result = (a != b); + break; + + case RCO_GT: + result = (a > b); + break; + + case RCO_GE: + result = (a >= b); + break; + + default: + assert(false); + result = false; + break; + + } + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : a = premier élément à consulter pour une comparaison. * +* b = second objet à consulter pour une comparaison. * +* op = opération de comparaison à réaliser. * +* * +* Description : Réalise une comparaison riche entre valeurs entière. * +* * +* Retour : Bilan des opérations de comparaison. * +* * +* Remarques : - * +* * +******************************************************************************/ + +bool compare_rich_integer_values_unsigned(unsigned long long a, unsigned long long b, RichCmpOperation op) { bool result; /* Bilan à retourner */ |