diff options
| author | gingerBill <bill@gingerbill.org> | 2021-07-11 16:08:16 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-07-11 16:08:16 +0100 |
| commit | 460e14e5860a503b8e7716ce18a29eb99f517cf7 (patch) | |
| tree | 058edb259fd5e6cab889f7b12156938c748509c0 /src/libtommath/mp_complement.c | |
| parent | ebcabb8a27ace67c3cd869a573df62b260000ee8 (diff) | |
Change the compiler's big integer library to use libTomMath
This now replaces Bill's crappy big int implementation
Diffstat (limited to 'src/libtommath/mp_complement.c')
| -rw-r--r-- | src/libtommath/mp_complement.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libtommath/mp_complement.c b/src/libtommath/mp_complement.c new file mode 100644 index 000000000..c16e25f9d --- /dev/null +++ b/src/libtommath/mp_complement.c @@ -0,0 +1,13 @@ +#include "tommath_private.h" +#ifdef MP_COMPLEMENT_C +/* LibTomMath, multiple-precision integer library -- Tom St Denis */ +/* SPDX-License-Identifier: Unlicense */ + +/* b = ~a */ +mp_err mp_complement(const mp_int *a, mp_int *b) +{ + mp_int a_ = *a; + a_.sign = ((a_.sign == MP_ZPOS) && !mp_iszero(a)) ? MP_NEG : MP_ZPOS; + return mp_sub_d(&a_, 1uL, b); +} +#endif |