mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 03:22:48 -05:00
Add functions mp_max and mp_max_into.
These are easy, and just like the existing mp_min family; I just hadn't needed them before now.
This commit is contained in:
12
mpint.c
12
mpint.c
@ -2109,6 +2109,11 @@ void mp_min_into(mp_int *r, mp_int *x, mp_int *y)
|
||||
mp_select_into(r, x, y, mp_cmp_hs(x, y));
|
||||
}
|
||||
|
||||
void mp_max_into(mp_int *r, mp_int *x, mp_int *y)
|
||||
{
|
||||
mp_select_into(r, y, x, mp_cmp_hs(x, y));
|
||||
}
|
||||
|
||||
mp_int *mp_min(mp_int *x, mp_int *y)
|
||||
{
|
||||
mp_int *r = mp_make_sized(size_t_min(x->nw, y->nw));
|
||||
@ -2116,6 +2121,13 @@ mp_int *mp_min(mp_int *x, mp_int *y)
|
||||
return r;
|
||||
}
|
||||
|
||||
mp_int *mp_max(mp_int *x, mp_int *y)
|
||||
{
|
||||
mp_int *r = mp_make_sized(size_t_max(x->nw, y->nw));
|
||||
mp_max_into(r, x, y);
|
||||
return r;
|
||||
}
|
||||
|
||||
mp_int *mp_power_2(size_t power)
|
||||
{
|
||||
mp_int *x = mp_new(power + 1);
|
||||
|
Reference in New Issue
Block a user