Merge pull request #578 from PX4/fix_mp_prime_strong_lucas_lefridge_compilation
[libtommath.git] / mp_clear.c
blob11094b26235fcb5f0350011dec0bdac61a4fe69b
1 #include "tommath_private.h"
2 #ifdef MP_CLEAR_C
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis */
4 /* SPDX-License-Identifier: Unlicense */
6 /* clear one (frees) */
7 void mp_clear(mp_int *a)
9 /* only do anything if a hasn't been freed previously */
10 if (a->dp != NULL) {
11 /* free ram */
12 MP_FREE_DIGS(a->dp, a->alloc);
14 /* reset members to make debugging easier */
15 a->dp = NULL;
16 a->alloc = a->used = 0;
17 a->sign = MP_ZPOS;
20 #endif