diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cmp.c | 20 | ||||
-rw-r--r-- | src/cmp.h | 10 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/cmp.c b/src/cmp.c new file mode 100644 index 0000000..9784aae --- /dev/null +++ b/src/cmp.c @@ -0,0 +1,20 @@ +#include "config.h" + +#include <stddef.h> + +#include "cmp.h" + + + +enum Comparison +cmp_size(const size_t a, const size_t b) { + if (a > b) { + return Comparison_GREATER; + } + + if (a < b) { + return Comparison_LESSER; + } + + return Comparison_EQUAL; +} diff --git a/src/cmp.h b/src/cmp.h new file mode 100644 index 0000000..0fbfe39 --- /dev/null +++ b/src/cmp.h @@ -0,0 +1,10 @@ +enum Comparison { + Comparison_LESSER, + Comparison_EQUAL, + Comparison_GREATER, +}; + + + +enum Comparison +cmp_size(const size_t a, const size_t b); |