aboutsummaryrefslogtreecommitdiff
path: root/src/big_int.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-07-11 16:18:30 +0100
committergingerBill <bill@gingerbill.org>2021-07-11 16:18:30 +0100
commit63b572a0abd9fb3b64b4b70b3f94dbafb4642f57 (patch)
treea89b2a7da5d31279ffc47406874839ac3f868bce /src/big_int.cpp
parente90e7d4af985b0b19e23f87e45b9add5aab98f69 (diff)
Clean up big int to LLVM integer code
Diffstat (limited to 'src/big_int.cpp')
-rw-r--r--src/big_int.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/big_int.cpp b/src/big_int.cpp
index 74683ef63..9ed753753 100644
--- a/src/big_int.cpp
+++ b/src/big_int.cpp
@@ -55,6 +55,8 @@ void big_int_mul_eq(BigInt *dst, BigInt const *x);
void big_int_quo_eq(BigInt *dst, BigInt const *x);
void big_int_rem_eq(BigInt *dst, BigInt const *x);
+bool big_int_is_neg(BigInt const *x);
+
void big_int_add_eq(BigInt *dst, BigInt const *x) {
BigInt res = {};
@@ -450,6 +452,13 @@ void big_int_not(BigInt *dst, BigInt const *x, i32 bit_count, bool is_signed) {
big_int_dealloc(&v);
}
+bool big_int_is_neg(BigInt const *x) {
+ if (x == nullptr) {
+ return false;
+ }
+ return x->sign != MP_ZPOS;
+}
+
char digit_to_char(u8 digit) {
GB_ASSERT(digit < 16);