diff options
| author | Syndamia <kamen@syndamia.com> | 2026-05-28 15:56:36 +0300 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2026-07-12 09:14:06 +0300 |
| commit | 5ada8e81f9ba039da2469ba694a9b6f5a91a8c87 (patch) | |
| tree | 7d8365cfc2ceab3f8356dba8d79ae9d6f713d5fc /BigInt.h | |
| parent | 5d755f45e31d81d771140cfe5f3dbd13d5442bcd (diff) | |
| download | foollib-5ada8e81f9ba039da2469ba694a9b6f5a91a8c87.tar foollib-5ada8e81f9ba039da2469ba694a9b6f5a91a8c87.tar.gz foollib-5ada8e81f9ba039da2469ba694a9b6f5a91a8c87.zip | |
fix: Improve argument checks and constraints
Diffstat (limited to 'BigInt.h')
| -rw-r--r-- | BigInt.h | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -10,7 +10,7 @@ typedef void* BigInt; 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_dup(MemoryManager *mm, const BigInt bigint); BigInt B_newsum(MemoryManager *mm, BigInt a, BigInt b); BigInt B_newsub(MemoryManager *mm, BigInt a, BigInt b); @@ -21,21 +21,21 @@ Result B_free(BigInt *bigint); /* Modify */ -Result B_sum(BigInt *a, BigInt b); -Result B_sub(BigInt *a, BigInt b); +Result B_sum(BigInt *a, const BigInt b); +Result B_sub(BigInt *a, const BigInt b); Result B_compl(BigInt *x); -Result B_bitand(BigInt *x, BigInt *y); -Result B_bitor(BigInt *x, BigInt *y); -Result B_bitxor(BigInt *x, BigInt *y); +Result B_bitand(BigInt *x, const BigInt y); +Result B_bitor(BigInt *x, const BigInt y); +Result B_bitxor(BigInt *x, const BigInt y); 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); +usize B_bytes(const BigInt x); +usize B_bitwidth(const BigInt x); +char* B_tostr(MemoryManager *mm, const BigInt x); int B_eq(const BigInt x, const BigInt y); int B_not_eq(const BigInt x, const BigInt y); |
