blob: 913e249cbb07cdec7a6bbb11cdea9eabf5af78da (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#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_newbytes(MemoryManager *mm, usize bytes);
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);
Result B_rshift(BigInt *x, usize shift);
Result B_lshift(BigInt *x, usize shift);
/* Get */
usize B_bytes(BigInt x);
usize B_bitwidth(BigInt x);
char* B_tostr(MemoryManager *mm, BigInt x);
#endif /* _BIGINT */
|