1 #include "tommath_private.h"
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis */
4 /* SPDX-License-Identifier: Unlicense */
6 /* compare two ints (signed)*/
7 mp_ord
mp_cmp(const mp_int
*a
, const mp_int
*b
)
9 /* compare based on sign */
10 if (a
->sign
!= b
->sign
) {
11 return mp_isneg(a
) ? MP_LT
: MP_GT
;
14 /* if negative compare opposite direction */
16 MP_EXCH(const mp_int
*, a
, b
);
19 return mp_cmp_mag(a
, b
);