summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-06-14 14:07:05 -0300
committerEuAndreh <eu@euandre.org>2024-06-14 14:07:05 -0300
commitf28724811ceea6b95b471774665845c916626d68 (patch)
treec7f4fa1d88a0216e84bbbfaee20d3c6008619c61 /src
parentsrc/trace.h: Init tracing functions (diff)
downloadpindaiba-f28724811ceea6b95b471774665845c916626d68.tar.gz
pindaiba-f28724811ceea6b95b471774665845c916626d68.tar.xz
src/cmp.{c,h}: Add minimal implementation of cmp_size()
Diffstat (limited to 'src')
-rw-r--r--src/cmp.c20
-rw-r--r--src/cmp.h10
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);