aboutsummaryrefslogtreecommitdiff
path: root/BigInt.h
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2026-05-17 17:57:57 +0300
committerSyndamia <kamen@syndamia.com>2026-05-17 17:57:57 +0300
commit72f791227cf3f0e835e62ff22953c005a40882c6 (patch)
tree0a876a9a61adf8418ffe4875b121c61798c548bc /BigInt.h
parentd23f6d3be400e7f51c3171d1dbd85da8b8d430ce (diff)
downloadfoollib-72f791227cf3f0e835e62ff22953c005a40882c6.tar
foollib-72f791227cf3f0e835e62ff22953c005a40882c6.tar.gz
foollib-72f791227cf3f0e835e62ff22953c005a40882c6.zip
feat(BigInt): Implement create/free and summation, subtraction
Diffstat (limited to 'BigInt.h')
-rw-r--r--BigInt.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/BigInt.h b/BigInt.h
new file mode 100644
index 0000000..2324143
--- /dev/null
+++ b/BigInt.h
@@ -0,0 +1,32 @@
+#ifndef _BIGINT
+#define _BIGINT
+
+#include "MemoryManager.h"
+
+typedef void* BigInt;
+
+/* Create */
+
+BigInt B_new(MemoryManager *mm, int value);
+BigInt B_newstr(MemoryManager *mm, const char* str);
+BigInt B_dup(MemoryManager *mm, BigInt bigint);
+
+BigInt B_newsum(MemoryManager *mm, BigInt a, BigInt b);
+BigInt B_newsub(MemoryManager *mm, BigInt a, BigInt b);
+
+/* Free */
+
+Result B_free(BigInt *bigint);
+
+/* Modify */
+
+Result B_sum(BigInt *a, BigInt b);
+Result B_sub(BigInt *a, BigInt b);
+
+/* Get */
+
+usize B_bytes(BigInt x);
+usize B_bitwidth(BigInt x);
+char* B_tostr(MemoryManager *mm, BigInt x);
+
+#endif /* _BIGINT */