1 #include "tommath_private.h"
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis */
4 /* SPDX-License-Identifier: Unlicense */
7 mp_err
mp_shrink(mp_int
*a
)
9 int alloc
= MP_MAX(MP_MIN_DIGIT_COUNT
, a
->used
);
10 if (a
->alloc
!= alloc
) {
11 mp_digit
*dp
= (mp_digit
*) MP_REALLOC(a
->dp
,
12 (size_t)a
->alloc
* sizeof(mp_digit
),
13 (size_t)alloc
* sizeof(mp_digit
));