mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 03:22:48 -05:00
Utility function mp_resize.
This reallocs an existing mp_int to have a different physical size, e.g. to make sure there's enough space at the top of it. Trivial, but I'm a little surprised I haven't needed it until now!
This commit is contained in:
@ -82,6 +82,14 @@ mp_int *mp_new(size_t maxbits)
|
||||
return mp_make_sized(words);
|
||||
}
|
||||
|
||||
mp_int *mp_resize(mp_int *mp, size_t newmaxbits)
|
||||
{
|
||||
mp_int *copy = mp_new(newmaxbits);
|
||||
mp_copy_into(copy, mp);
|
||||
mp_free(mp);
|
||||
return copy;
|
||||
}
|
||||
|
||||
mp_int *mp_from_integer(uintmax_t n)
|
||||
{
|
||||
mp_int *x = mp_make_sized(
|
||||
|
Reference in New Issue
Block a user