summaryrefslogtreecommitdiff
path: root/aarch64/kusswurm_ch11.c
diff options
context:
space:
mode:
authorHunter Kvalevog <hunter@kvog.sh>2026-06-09 20:17:36 -0500
committerHunter Kvalevog <hunter@kvog.sh>2026-06-09 20:17:36 -0500
commitaf04560da6f41a0e8e8f00bb4b5eba1127caecef (patch)
tree817469ca35c2377d5d070500e3c07d6ec4f78efe /aarch64/kusswurm_ch11.c
parentbbccc1a4879a828c963f1dd3de91d20281024599 (diff)
Diffstat (limited to 'aarch64/kusswurm_ch11.c')
-rw-r--r--aarch64/kusswurm_ch11.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/aarch64/kusswurm_ch11.c b/aarch64/kusswurm_ch11.c
new file mode 100644
index 0000000..4edfba0
--- /dev/null
+++ b/aarch64/kusswurm_ch11.c
@@ -0,0 +1,26 @@
+#include <stdint.h>
+#include <stdio.h>
+
+// example 1
+int32_t i32_add_sub(int32_t a, int32_t b, int32_t c);
+int64_t i64_add_sub(int64_t a, int64_t b, int64_t c);
+
+// example 2
+int32_t i32_mul(int32_t a, int32_t b);
+int64_t i32_mul_safe(int32_t a, int32_t b);
+
+#define PRINT_LOG(FMT, CODE) printf(#CODE ": " FMT "\n", CODE)
+
+int main(int argc, const char* argv[])
+{
+ // example 1
+ PRINT_LOG("%d", i32_add_sub(5, 3, 1));
+ PRINT_LOG("%lld", i64_add_sub(5, 3, 1));
+
+ // example 2
+ PRINT_LOG("%d", i32_mul(5, 6));
+ PRINT_LOG("%d", i32_mul(2000000000, 4));
+ PRINT_LOG("%lld", i32_mul_safe(5, 6));
+ PRINT_LOG("%lld", i32_mul_safe(2000000000, 4));
+}
+